Showing 21 of 32 total issues
Book
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Book extends Entity
{
const _OWN_TYPE = '';
const TYPE_AUDIO = 'audio';
File Book.php
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Bookboon\Api\Entity;
use Bookboon\Api\Bookboon;
Method executeQuery
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function executeQuery(
string $uri,
string $type = ClientInterface::HTTP_GET,
array $variables = [],
string $contentType = ClientInterface::CONTENT_TYPE_JSON
Method executeQuery
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function executeQuery(
$uri,
$type = self::HTTP_GET,
$variables = [],
$contentType = self::CONTENT_TYPE_FORM
Function getRemoteAddress
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function getRemoteAddress() : ?string
{
$hostname = null;
if (isset($_SERVER['REMOTE_ADDR'])) {
- 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 __construct
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(
string $apiId,
string $apiSecret,
Headers $headers,
array $scopes,
Method __construct
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
string $apiId,
string $apiSecret,
Headers $headers,
array $scopes,
CacheInterface $cache = null,
Function executeQuery
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function executeQuery(
string $uri,
string $type = ClientInterface::HTTP_GET,
array $variables = [],
string $contentType = ClientInterface::CONTENT_TYPE_JSON
- 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 executeQuery
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function executeQuery(
$uri,
$type = self::HTTP_GET,
$variables = [],
$contentType = self::CONTENT_TYPE_FORM
- 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 create
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
string $appId,
string $appSecret,
array $scopes,
array $headers = [],
?string $appUserId = null,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$apiId,
$apiSecret,
Headers $headers,
CacheInterface $cache = null,
$apiUri = null,
Function makeRequest
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function makeRequest(
string $relativeUrl,
array $variables = [],
string $httpMethod = ClientInterface::HTTP_GET,
bool $shouldCache = true,
- 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 getBySlug
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function getBySlug(Bookboon $bookboon, string $slug, array $bookTypes = ['professional'], ?int $limit = null, ?int $seed = null) : BookboonResponse
Method makeRequest
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $relativeUrl,
array $variables = [],
string $httpMethod = ClientInterface::HTTP_GET,
bool $shouldCache = true,
string $contentType = ClientInterface::CONTENT_TYPE_JSON
Method search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Bookboon $bookboon,
string $query,
int $limit = 10,
int $offset = 0,
array $bookTypes = ['professional']
Method rawRequest
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $url,
array $variables = [],
string $httpMethod = ClientInterface::HTTP_GET,
bool $shouldCache = true,
string $classString = Entity::class
Method recommendations
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Bookboon $bookboon,
array $bookIds = [],
int $limit = 5,
array $bookTypes = ['professional'],
array $params = []
Method makeRequest
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $relativeUrl,
array $variables = [],
string $httpMethod = self::HTTP_GET,
bool $shouldCache = true,
string $contentType = self::CONTENT_TYPE_FORM
Function recursiveBlacklist
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function recursiveBlacklist(array &$categories, array $blacklistedCategoryIds) : void
{
$hasAlteredArray = false;
foreach ($categories as $key => $category) {
- 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 thumbnailResolver
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function thumbnailResolver($thumbnails, $size) : string
{
if (false === is_array($thumbnails) || count($thumbnails) === 0) {
return '';
}
- 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"