Showing 100 of 100 total issues
Function parameter
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function parameter(string $value): mixed
{
$res = [];
$parts = \preg_split('#(%[^%\s]+%)#i', $value, -1, \PREG_SPLIT_DELIM_CAPTURE);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method bootExtensions
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function bootExtensions(array $extensions, \SplStack &$afterLoading, string $extraKey = null): void
{
$container = $this->container;
foreach ($extensions as $resolved) {
Method resolveReference
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function resolveReference(string $reference): mixed
{
$invalidBehavior = $this->container::EXCEPTION_ON_MULTIPLE_SERVICE;
if ('?' === $reference[0]) {
Method resolveStmt
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function resolveStmt(array $expressions, string $parentId, bool $leaveNodes = false): void
{
foreach ($expressions as &$expression) {
if ($expression instanceof Expression || $expression instanceof Return_) {
$expression = $expression->expr;
Method resolveClass
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function resolveClass(string $class, array $args = []): object
{
if (\is_subclass_of($class, ServiceProviderInterface::class)) {
$services = [];
Function compile
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function compile(array $options = [])
{
$options += ['strictType' => true, 'printToString' => true, 'containerClass' => 'CompiledContainer'];
$astNodes = $options['strictType'] ? [new Declare_([new DeclareDeclare('strict_types', $this->resolver->getBuilder()->val(1))])] : [];
$processedData = $this->doAnalyse($this->definitions);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method resolveProxies
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function resolveProxies(ContainerBuilder $container, BuilderFactory $builder, array $proxiedServices): array
{
$builtProxies = [];
foreach ($proxiedServices as $method => $proxy) {
Method buildTraits
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildTraits(string $cacheDirectory, array $includePaths = []): string
{
$traitsDirectory = \rtrim($cacheDirectory, '/') . '/Definitions' . $this->traitHash($cacheDirectory);
$autoLoadAst = [];
Method sortExtensions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sortExtensions(array $extensions): array
{
if (0 === \count($extensions)) {
return [];
}
Method autowireArguments
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function autowireArguments(\ReflectionFunctionAbstract $function, array $args = []): array
{
$resolvedParameters = [];
$nullValuesFound = 0;
$args = $this->resolveArguments($args); // Resolves provided arguments.
Method resolveCallable
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function resolveCallable(callable|array $callback, array $arguments = []): mixed
{
if (\is_array($callback)) {
if ((2 === \count($callback) && \array_is_list($callback)) && \is_string($callback[1])) {
$callback[0] = $this->resolve($callback[0]);
Function getTypes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function getTypes(\Reflector $reflection): array
{
if ($reflection instanceof \ReflectionParameter || $reflection instanceof \ReflectionProperty) {
$type = $reflection->getType();
} elseif ($reflection instanceof \ReflectionFunctionAbstract) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function typed
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function typed(string ...$to)
{
$this->options['typed'] = true;
if ([] === $to) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method load
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function load($resource, string $type = null): void
{
$container = $this->builder->getContainer();
$path = $this->locator->locate($resource);
Method resolve
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function resolve(Container $container): array
{
$i = 0;
$services = $refs = [];
Method doLoad
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function doLoad(string $id, int $invalidBehavior): mixed
{
if (null == ($definition = $this->definitions[$id] ?? null)) {
if (\array_key_exists($id, $this->types)) {
return $this->autowired($id, 1 === ($invalidBehavior & self::EXCEPTION_ON_MULTIPLE_SERVICE));
Method afterTraverse
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function afterTraverse(array $nodes)
{
$node = $nodes[1] ?? $nodes[0];
if (isset($nodes[0]) && $nodes[0] instanceof Declare_) {
Method resolveArguments
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function resolveArguments(array $arguments = []): array
{
foreach ($arguments as $key => $value) {
if (\is_array($value)) {
$resolved = $this->resolveArguments($value);
Function load
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function load($resource, string $type = null): void
{
$container = $this->builder->getContainer();
$path = $this->locator->locate($resource);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function enterNode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function enterNode(\PhpParser\Node $node)
{
if (!$node instanceof \PhpParser\Node\Stmt\ClassMethod) {
return parent::enterNode($node);
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"