Counts number of times given generated pattern id is covered by patterns ids collected during tests

@param string   $id
@param string[] $covered

@return int
327496
private function getCoverageCount(string $id, array $covered) : int
    {
        $id              = str_replace('\/', '/', $id);
        [$u, $c, $d, $p] = explode('::', $id);

        $u = preg_quote(mb_substr($u, 1), '/');
        $c = preg_quote(mb_substr($c, 1), '/');
        $p = preg_quote(mb_substr($p, 1), '/');
        $d = preg_quote(mb_substr($d, 1), '/');

        $count = 0;

        if (0 === mb_strlen($p)) {
            $p = '.*?';
        }
        if (0 === mb_strlen($d)) {
            $d = '.*?';
        }

        $regex = sprintf('/^u%d::c%d::d%s::p%s$/', $u, $c, $d, $p);

        foreach ($covered as $patternId) {
            if (preg_match($regex, $patternId)) {
                ++$count;
            }
        }

        return $count;
    }
1167055
public function translationLengthFilter($id)
    { 
        $total = 0;
        foreach ($this->translator->getMessages()['messages'] as $position => $message) {
            if (substr($position, 0, strlen($id)) === $id) {
                $total++;
            }
        }

        return $total - 1;
    }
15620
public function todo_itemCount($id) {
        // I know eloquent does this, but having trouble so hand crafting using DB
        $record =  DB::table('todo_items')->where('priority_id', '=', $id)->get();
        return count($record);
    }
113913
public function childCount($id, array $options = [])
	{
		$options['for'] = $id;

		$query = $this->findChildren($this->_table->find(), $options);

		return $query->count();
	}
1347899
public static function checkSlug($slug, $id = 0)
    {
        $count = self::factory()
                    ->where('slug',$slug)
                    ->where_not_equal('id',$id)
                    ->count();

        return $count > 0;
    }
588226
public function contains( $id ) {

		$contains = isset( $this->cache[ $id ] ) || array_key_exists( $id, $this->cache );

		if ( !$contains ) {
			return false;
		}

		if ( $this->ttl[ $id ] > 0 && $this->ttl[ $id ] <= microtime( true ) ) {
			return false;
		}

		return true;
	}
1058394
public function countDrafts($blogId, $data = [], $includeDeleted = false)
    {
        $data['where'] = [
            ['blog_id', $blogId],
            ['is_published', false],
        ];

        return $this->countAll($data, $includeDeleted);
    }
716586
public function getMatchCount(ModelInterface $model = null, PropertyValueBag $input = null)
    {
        $totalCount = false;

        foreach ($this->conditions as $condition) {
            if (!($condition instanceof PaletteConditionInterface)) {
                throw new DcGeneralRuntimeException('Invalid condition in chain: ' . \get_class($condition));
            }

            $conditionCount = $condition->getMatchCount($model, $input);

            if (false !== $conditionCount) {
                $totalCount += $conditionCount;
            } elseif (static::AND_CONJUNCTION === $this->conjunction) {
                return false;
            }
        }

        return $totalCount;
    }
339877
public function getCount( $pattern = NULL )
	{
		$count	= 0;
		$list	= $this->getList( $pattern );
		foreach( $list as $entry )
			$count++;
		return $count;
	}
520145
public function delete($id): ?int
  {
    return $this->db->delete($this->class_cfg['table'], [$this->fields['id'] => $id]);
  }
311412
public function flushTraceId($id)
    {
        if (_CLI_) {
            if (isset($this->_traceId[$id])) {
                unset($this->_traceId[$id]);
            }
        }
    }
462433
public function countContentObjectsInSection($id)
    {
        try {
            return $this->innerGateway->countContentObjectsInSection($id);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
542576
public function has($id)
    {
        return isset($this->watched[$id]) && 0 !== $this->watched[$id]->count();
    }
346968
public function complete($id)
    {
        $id = (int) $id;
        if ($id <= 0) {
            throw new Exception('Invalid param id');
        }
        return $this->rest->put("$this->action/$id/complete");
    }
369649
public function deleteByStringId(string $id, string $key = null): int
    {
        return $this->deleteByKey($id, $key);
    }
1076028
protected function _coverage($file, $coverage)
    {
        $result = [];
        $root = $this->parse($file);
        foreach ($root->lines['content'] as $num => $content) {
            $coverable = null;
            foreach ($content['nodes'] as $node) {
                if ($node->coverable && $node->lines['stop'] === $num) {
                    $coverable = $node;
                    break;
                }
            }
            if (!$coverable) {
                continue;
            }
            if (isset($coverage[$num])) {
                $result[$num] = $coverage[$num];
            } elseif (isset($coverable->lines['begin'])) {
                for ($i = $coverable->lines['begin']; $i <= $num; $i++) {
                    if (isset($coverage[$i])) {
                        $result[$num] = $coverage[$i];
                        break;
                    }
                }
                if (!isset($result[$num])) {
                    $result[$num] = 0;
                }
            } else {
                $result[$num] = 0;
            }
        }
        return $result;
    }
22042
public CronPattern getPattern(String id) {
		final int index = ids.indexOf(id);
		if (index > -1) {
			return getPattern(index);
		}
		return null;
	}