Showing 21 of 21 total issues
RestObject
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class RestObject implements IRestObject
{
private $updateMode = false;
private $replaceMode = false;
SchemaValidator
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class SchemaValidator
{
protected $fields = [];
protected $allowExtraneous = false;
protected $requiredSchemaClass = null;
Method parseWhere
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseWhere($conditions, $logical)
{
$subGroup = [];
foreach ($conditions as $key => $condition) {
switch (strtoupper($key)) {
Method castArray
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function castArray($array, $itemDetails)
{
$itemType = $this->getArrayItemType($itemDetails);
if ($itemType === self::TYPE_OTHER) {
return $array;
Method patch
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function patch($resourceId, $newResource)
{
try {
if (isset($newResource->{$this->primaryKey})) {
unset($newResource->{$this->primaryKey});
Method castSchema
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function castSchema($object, $schema)
{
$properties = get_object_vars($object);
foreach ($properties as $propertyName => $propertyValue) {
$propertyType = $this->getPropertyType($propertyName, $schema);
Function parseWhere
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function parseWhere($conditions, $logical)
{
$subGroup = [];
foreach ($conditions as $key => $condition) {
switch (strtoupper($key)) {
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($resourceName, $schemaClass, $primaryKey, Client $client = null, $databaseName = null)
Method put
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function put($resourceName, $schema, $primaryKey, $resourceId, $newResource);
Method put
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function put($resourceName, $schema, $primaryKey, $resourceId, $newResource)
Method patch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function patch($resourceName, $schema, $primaryKey, $resourceId, $newResource)
Method patch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function patch($resourceName, $schema, $primaryKey, $resourceId, $newResource);
Function validateCircularDependency
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function validateCircularDependency($schemaName, $schemaDefinition, $schemaChain = [])
{
$schemaChain[] = $schemaName;
foreach ($schemaDefinition as $field => $fieldDetails)
{
- 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 removeExtraneous
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function removeExtraneous()
{
$schema = $this->schema();
foreach (get_object_vars($this) as $name => $value) {
if (!array_key_exists($name, $schema)) {
- 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 validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function validate($value)
{
$details = [];
$this->validateType($value);
if ($value !== 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
Avoid too many return
statements within this method. Open
return $res;
Avoid too many return
statements within this method. Open
return $this->bsonArraySerialize($res);
Function castArray
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function castArray($array, $itemDetails)
{
$itemType = $this->getArrayItemType($itemDetails);
if ($itemType === self::TYPE_OTHER) {
return $array;
- 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 validateItems
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function validateItems($value)
{
$errors = [];
$this->itemValidator->updateMode($this->updateMode());
$this->itemValidator->replaceMode($this->replaceMode());
- 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 validateFieldTypes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function validateFieldTypes($resource)
{
$validatorFactory = new ValidatorFactory;
$errors = [];
foreach ($resource->schema() as $fieldName => $rules) {
- 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"