Showing 19 of 19 total issues
Function createDefinitions
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
public function createDefinitions($source)
{
if (!interface_exists($source)) {
throw new InvalidArgumentException(sprintf(
'Class or interface `%s` is specified as a resource definition source, but it doesn\'t exist',
- 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 createDefinitions
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createDefinitions($source)
{
if (!interface_exists($source)) {
throw new InvalidArgumentException(sprintf(
'Class or interface `%s` is specified as a resource definition source, but it doesn\'t exist',
Function __call
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function __call($name, $arguments)
{
if (!array_key_exists($name, $this->resources)) {
throw UndefinedResourceException::create($name, array_keys($this->resources));
}
- 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 forTypeMismatch
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function forTypeMismatch($expected, $actual)
{
$expectedClasses = [];
$expectedTypes = [];
- 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 hydrateParameters
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function hydrateParameters($definitions, $arguments)
{
$i = 0;
$parameters = [];
- 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 process
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(ResponseInterface $response, ResourceDefinitionInterface $resource)
{
if (!$response instanceof ApiResponse) {
throw new \InvalidArgumentException(sprintf(
'Expected an ApiResponse, got %s',
Method execute
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$driver = new AnnotationDriver();
$definitions = $driver->createDefinitions(GithubApi::class);
$adapter = new GuzzleHttpAdapter(new Client());
Method forTypeMismatch
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function forTypeMismatch($expected, $actual)
{
$expectedClasses = [];
$expectedTypes = [];
Method generate
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generate(ResourceDefinitionInterface $resourceDefinition, array $parameters = array())
{
$definedParams = $resourceDefinition->getParameters();
if (count($definedParams) < count($parameters)) {
Method processParameters
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function processParameters($path, array $parameters = array())
{
preg_match_all('/\{([a-zA-Z.]+)\}/', $path, $matches);
$paramNames = $matches[1];
Method __call
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __call($name, $arguments)
{
if (!array_key_exists($name, $this->resources)) {
throw UndefinedResourceException::create($name, array_keys($this->resources));
}
Method createEndpoint
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function createEndpoint($baseUrl, array $definitions, array $listeners = array(), HttpAdapterInterface $adapter = null, Router $router = null)
{
if (!$adapter) {
$adapter = new GuzzleHttpAdapter(new Client());
}
Method process
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(ResponseInterface $response, ResourceDefinitionInterface $resource)
{
if (!$response instanceof ApiResponse) {
throw new InvalidArgumentException(sprintf(
'Expected an `ApiResponse`, got `%s` instead',
Method createEndpoint
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function createEndpoint($baseUrl, array $definitions, array $listeners = array(), HttpAdapterInterface $adapter = null, Router $router = null)
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($method, $uri, array $headers = [], $body = null, $protocolVersion = '1.1')
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($name, $method, $path, $returnType = null, array $parameters = array())
Function process
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function process(ResponseInterface $response, ResourceDefinitionInterface $resource)
{
if (!$response instanceof ApiResponse) {
throw new \InvalidArgumentException(sprintf(
'Expected an ApiResponse, got %s',
- 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 createEndpoint
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function createEndpoint($baseUrl, array $definitions, array $listeners = array(), HttpAdapterInterface $adapter = null, Router $router = null)
{
if (!$adapter) {
$adapter = new GuzzleHttpAdapter(new 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
Function processParameters
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function processParameters($path, array $parameters = array())
{
preg_match_all('/\{([a-zA-Z.]+)\}/', $path, $matches);
$paramNames = $matches[1];
- 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"