Showing 42 of 46 total issues
Phake
has 46 functions (exceeds 20 allowed). Consider refactoring. Open
class Phake
{
private static ?Phake\Facade $phake = null;
private static ?Phake\Client\IClient $client = null;
File MockClass.php
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* Phake - Mocking Framework
*
* Copyright (c) 2010-2022, Mike Lively <m@digitalsandwich.com>
File Phake.php
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* Phake - Mocking Framework
*
* Copyright (c) 2010-2022, Mike Lively <m@digitalsandwich.com>
Function generate
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function generate(string $newClassName, string|array $mockedClassName, \Phake\Mock\InfoRegistry $infoRegistry): void
{
$extends = '';
$implements = '';
$interfaces = [];
- 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 verifyCall
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function verifyCall(CallExpectation $expectation): VerifierResult
{
$matcher = new \Phake\Matchers\MethodMatcher($expectation->getMethod(), $expectation->getArgumentMatcher());
$calls = $this->recorder->getAllCalls();
- 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 generate
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generate(string $newClassName, string|array $mockedClassName, \Phake\Mock\InfoRegistry $infoRegistry): void
{
$extends = '';
$implements = '';
$interfaces = [];
Function resolveNamedArguments
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function resolveNamedArguments(\Phake\IMock|string $object, string $method, array $arguments): array
{
$positionalArguments = [];
$namedArguments = [];
foreach ($arguments as $key => $arg) {
- 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 implementMethod
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function implementMethod(\ReflectionMethod $method, bool $static = false): string
{
$modifiers = implode(
' ',
\Reflection::getModifierNames($method->getModifiers() & ~\ReflectionMethod::IS_ABSTRACT)
Function reflectionTypeToString
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function reflectionTypeToString(\ReflectionType $type, \ReflectionClass $selfClass): string
{
$result = '';
$nullable = '';
- 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 setClient
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function setClient(Phake\Client\IClient|string|null $client): void
{
if ($client instanceof Phake\Client\IClient) {
self::$client = $client;
} elseif (self::CLIENT_PHPUNIT8 == $client) {
- 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 verifyCall
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function verifyCall(CallExpectation $expectation): VerifierResult
{
$matcher = new \Phake\Matchers\MethodMatcher($expectation->getMethod(), $expectation->getArgumentMatcher());
$calls = $this->recorder->getAllCalls();
Method getReturnTypeResult
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getReturnTypeResult(?\ReflectionType $returnType, \ReflectionMethod $method): mixed
{
if (null === $returnType) {
return null;
} elseif ($returnType instanceof \ReflectionNamedType) {
Method resolveNamedArguments
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function resolveNamedArguments(\Phake\IMock|string $object, string $method, array $arguments): array
{
$positionalArguments = [];
$namedArguments = [];
foreach ($arguments as $key => $arg) {
Method reflectionTypeToString
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function reflectionTypeToString(\ReflectionType $type, \ReflectionClass $selfClass): string
{
$result = '';
$nullable = '';
Function getReturnTypeResult
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getReturnTypeResult(?\ReflectionType $returnType, \ReflectionMethod $method): mixed
{
if (null === $returnType) {
return null;
} elseif ($returnType instanceof \ReflectionNamedType) {
- 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 doArgumentsMatch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function doArgumentsMatch(array &$arguments): void
{
$argumentCopy = $arguments;
$nextArgument = null;
- 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 implementParameter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function implementParameter(\ReflectionParameter $parameter): string
{
$default = '';
$type = '';
- 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 setClient
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function setClient(Phake\Client\IClient|string|null $client): void
{
if ($client instanceof Phake\Client\IClient) {
self::$client = $client;
} elseif (self::CLIENT_PHPUNIT8 == $client) {
Method implementParameter
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function implementParameter(\ReflectionParameter $parameter): string
{
$default = '';
$type = '';
Function verifyCallsInOrder
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function verifyCallsInOrder(array $calls): bool
{
$call1 = array_shift($calls);
$call2 = array_shift($call1);
- 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"