nabbar/SwaggerValidator-PHP

View on GitHub

Showing 604 of 604 total issues

The class TypeCombined has an overall complexity of 64 which is very high. The configured complexity threshold is 50.
Open

class TypeCombined extends \SwaggerValidator\Common\CollectionSwagger
{

    public function __construct()
    {
Severity: Minor
Found in src/DataType/TypeCombined.php by phpmd

TypeCommon has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class TypeCommon extends \SwaggerValidator\Common\CollectionSwagger
{

    abstract protected function type(\SwaggerValidator\Common\Context $context, $valueParams);

Severity: Minor
Found in src/DataType/TypeCommon.php - About 3 hrs to fix

    The class TypeCommon has 14 public methods. Consider refactoring TypeCommon to keep number of public methods under 10.
    Open

    abstract class TypeCommon extends \SwaggerValidator\Common\CollectionSwagger
    {
    
        abstract protected function type(\SwaggerValidator\Common\Context $context, $valueParams);
    
    
    Severity: Minor
    Found in src/DataType/TypeCommon.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    The class TypeObject has an overall complexity of 65 which is very high. The configured complexity threshold is 50.
    Open

    class TypeObject extends \SwaggerValidator\Common\CollectionSwagger
    {
    
        /**
         *
    Severity: Minor
    Found in src/DataType/TypeObject.php by phpmd

    The class Context has an overall complexity of 152 which is very high. The configured complexity threshold is 50.
    Open

    class Context extends ContextBase implements \SwaggerValidator\Interfaces\ContextLog, \SwaggerValidator\Interfaces\ContextDataLoader, \SwaggerValidator\Interfaces\ContextDataParser
    {
        /*
         * Mode Constants
         */
    Severity: Minor
    Found in src/Common/Context.php by phpmd

    The class Context has 29 non-getter- and setter-methods. Consider refactoring Context to keep number of methods under 25.
    Open

    class Context extends ContextBase implements \SwaggerValidator\Interfaces\ContextLog, \SwaggerValidator\Interfaces\ContextDataLoader, \SwaggerValidator\Interfaces\ContextDataParser
    {
        /*
         * Mode Constants
         */
    Severity: Minor
    Found in src/Common/Context.php by phpmd

    TooManyMethods

    Since: 0.1

    A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    The default was changed from 10 to 25 in PHPMD 2.3.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanymethods

    The class TypeCommon has an overall complexity of 77 which is very high. The configured complexity threshold is 50.
    Open

    abstract class TypeCommon extends \SwaggerValidator\Common\CollectionSwagger
    {
    
        abstract protected function type(\SwaggerValidator\Common\Context $context, $valueParams);
    
    
    Severity: Minor
    Found in src/DataType/TypeCommon.php by phpmd

    The class CollectionReference has an overall complexity of 56 which is very high. The configured complexity threshold is 50.
    Open

    class CollectionReference extends \SwaggerValidator\Common\Collection
    {
    
        const ID_PREFIX = 'id:';
    
    
    Severity: Minor
    Found in src/Common/CollectionReference.php by phpmd

    The class CollectionSwagger has an overall complexity of 63 which is very high. The configured complexity threshold is 50.
    Open

    class CollectionSwagger extends \SwaggerValidator\Common\Collection
    {
    
        /**
         *
    Severity: Minor
    Found in src/Common/CollectionSwagger.php by phpmd

    The class ContextBase has an overall complexity of 102 which is very high. The configured complexity threshold is 50.
    Open

    class ContextBase implements \SwaggerValidator\Interfaces\ContextBase
    {
    
        /**
         *
    Severity: Minor
    Found in src/Common/ContextBase.php by phpmd

    The class ContextBase has 12 public methods. Consider refactoring ContextBase to keep number of public methods under 10.
    Open

    class ContextBase implements \SwaggerValidator\Interfaces\ContextBase
    {
    
        /**
         *
    Severity: Minor
    Found in src/Common/ContextBase.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    The class TypeArray has an overall complexity of 51 which is very high. The configured complexity threshold is 50.
    Open

    class TypeArray extends \SwaggerValidator\DataType\TypeCommon
    {
    
        public function __construct()
        {
    Severity: Minor
    Found in src/DataType/TypeArray.php by phpmd

    The class TypeString has an overall complexity of 58 which is very high. The configured complexity threshold is 50.
    Open

    class TypeString extends \SwaggerValidator\DataType\TypeCommon
    {
    
        const PATTERN_BYTE     = '^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$';
        //const PATTERN_BINARY   = '^(?:([A-Fa-f0-9]{2})*|([01]{4}[ ]?)*)?$'; // Allow Hexa form
    Severity: Minor
    Found in src/DataType/TypeString.php by phpmd

    The class TypeArrayItems has an overall complexity of 67 which is very high. The configured complexity threshold is 50.
    Open

    class TypeArrayItems extends \SwaggerValidator\DataType\TypeCommon
    {
    
        protected $minItems = 1;
        protected $maxItems = null;
    Severity: Minor
    Found in src/DataType/TypeArrayItems.php by phpmd

    The class Context has 25 public methods. Consider refactoring Context to keep number of public methods under 10.
    Open

    class Context extends ContextBase implements \SwaggerValidator\Interfaces\ContextLog, \SwaggerValidator\Interfaces\ContextDataLoader, \SwaggerValidator\Interfaces\ContextDataParser
    {
        /*
         * Mode Constants
         */
    Severity: Minor
    Found in src/Common/Context.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    The class ReferenceFile has an overall complexity of 59 which is very high. The configured complexity threshold is 50.
    Open

    class ReferenceFile
    {
    
        const PATH_TYPE_URL  = 1;
        const PATH_TYPE_FILE = 2;
    Severity: Minor
    Found in src/Common/ReferenceFile.php by phpmd

    The class Collection has 19 public methods. Consider refactoring Collection to keep number of public methods under 10.
    Open

    class Collection implements \Countable, \IteratorAggregate, \ArrayAccess, \Serializable, \JsonSerializable
    {
    
        /**
         *
    Severity: Minor
    Found in src/Common/Collection.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    The class CollectionReference has 13 public methods. Consider refactoring CollectionReference to keep number of public methods under 10.
    Open

    class CollectionReference extends \SwaggerValidator\Common\Collection
    {
    
        const ID_PREFIX = 'id:';
    
    
    Severity: Minor
    Found in src/Common/CollectionReference.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                if ($key === \SwaggerValidator\Common\FactorySwagger::KEY_REFERENCE) {
                    $oldRef    = $value;
                    $value     = \SwaggerValidator\Common\CollectionReference::getIdFromRef($context, $value);
                    $context->logReference('replace', $value, $oldRef, __METHOD__, __LINE__);
                    $refList[] = $value;
    Severity: Major
    Found in src/Common/ReferenceItem.php and 1 other location - About 3 hrs to fix
    src/Common/ReferenceItem.php on lines 121..135

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 144.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                if ($key === \SwaggerValidator\Common\FactorySwagger::KEY_REFERENCE) {
                    $oldRef    = $value;
                    $value     = \SwaggerValidator\Common\CollectionReference::getIdFromRef($context, $value);
                    $context->logReference('replace', $value, $oldRef, __METHOD__, __LINE__);
                    $refList[] = $value;
    Severity: Major
    Found in src/Common/ReferenceItem.php and 1 other location - About 3 hrs to fix
    src/Common/ReferenceItem.php on lines 93..107

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 144.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Severity
    Category
    Status
    Source
    Language