vitiko/IphpFileStoreBundle

View on GitHub

Showing 18 of 18 total issues

Function updateUseOneProperties has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    protected function updateUseOneProperties(\Doctrine\Common\EventArgs $args, PropertyMapping $mapping)
    {
        $uploadedFile = $mapping->getFileUploadPropertyValue();

        //use getOldValue from ORM
Severity: Minor
Found in EventListener/UploaderListener.php - About 3 hrs to fix

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

PropertyMapping has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

class PropertyMapping
{


    protected $obj;
Severity: Minor
Found in Mapping/PropertyMapping.php - About 3 hrs to fix

    Function execute has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $entityFullName = $input->getOption('entity');
            $field = $input->getOption('field');
            $force = $input->getOption('force') ? true : false;
    Severity: Minor
    Found in Command/RepairFileDataCommand.php - About 1 hr to fix

    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 getConfigTreeBuilder has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getConfigTreeBuilder()
        {
            $tb = new TreeBuilder();
            $root = $tb->root('iphp_file_store');
    
    
    Severity: Minor
    Found in DependencyInjection/Configuration.php - About 1 hr to fix

      Function updateSeparateProperties has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function updateSeparateProperties(\Doctrine\Common\EventArgs $args, PropertyMapping $mapping)
          {
              $uploadedFile = $mapping->getFileUploadPropertyValue();
              $currentFileData = $mapping->getFileDataPropertyValue();
              $previousFileData = $this->dataStorage->previusFieldDataIfChanged($mapping->getFileDataPropertyName(), $args);
      Severity: Minor
      Found in EventListener/UploaderListener.php - About 1 hr to fix

      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 upload has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function upload(PropertyMapping $mapping, File $file)
          {
              $originalName = $this->getOriginalName($file);
              $mimeType = $this->getMimeType($file);
      
      
      Severity: Minor
      Found in FileStorage/FileSystemStorage.php - About 1 hr to fix

        Function getMappingFromField has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getMappingFromField($obj, \ReflectionClass $class, $field, $allFields = true)
            {
                if (!$this->hasAnnotations($class)) return null;
        
                $annotation = $this->driver->readUploadableField($class, $field);
        Severity: Minor
        Found in Mapping/PropertyMappingFactory.php - About 1 hr to fix

        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 execute has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function execute(InputInterface $input, OutputInterface $output)
            {
                $entityFullName = $input->getOption('entity');
                $field = $input->getOption('field');
                $force = $input->getOption('force') ? true : false;
        Severity: Minor
        Found in Command/RepairFileDataCommand.php - About 1 hr to fix

          Method updateUseOneProperties has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function updateUseOneProperties(\Doctrine\Common\EventArgs $args, PropertyMapping $mapping)
              {
                  $uploadedFile = $mapping->getFileUploadPropertyValue();
          
                  //use getOldValue from ORM
          Severity: Minor
          Found in EventListener/UploaderListener.php - About 1 hr to fix

            Function useDirectoryNamer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function useDirectoryNamer($fileName, $clientOriginalName)
                {
                    $path = '';
            
                    if ($this->hasDirectoryNamer()) {
            Severity: Minor
            Found in Mapping/PropertyMapping.php - About 55 mins to fix

            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 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function   __construct($path = null, $originalName = null, $mimeType = null,
                                              $size = null, $error = null, $test = false)
            Severity: Minor
            Found in File/File.php - About 45 mins to fix

              Function reverseTransform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function reverseTransform($fileDataFromForm)
                  {
                      //if file field != file upload field - no need to store 'delete' in serialized file data
                      if (isset($fileDataFromForm['delete']) && !$fileDataFromForm['delete'])
                          unset($fileDataFromForm['delete']);
              Severity: Minor
              Found in Form/DataTransformer/FileDataTransformer.php - About 45 mins to fix

              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 upload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function upload(PropertyMapping $mapping, File $file)
                  {
                      $originalName = $this->getOriginalName($file);
                      $mimeType = $this->getMimeType($file);
              
              
              Severity: Minor
              Found in FileStorage/FileSystemStorage.php - About 45 mins to fix

              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 rename has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function rename($serviceName, $method, PropertyMapping $propertyMapping, $fileName, $args = array())
              Severity: Minor
              Found in Naming/NamerServiceInvoker.php - About 35 mins to fix

                Function readUploadable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function readUploadable(\ReflectionClass $class)
                    {
                        $baseClassName = $className = $class->getNamespaceName() . '\\' . $class->getName();
                        do {
                            if (isset($this->uploadedClass[$className])) {
                Severity: Minor
                Found in Driver/AnnotationDriver.php - About 35 mins to fix

                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 postFlush has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function postFlush(EventArgs $args)
                    {
                        if (!$this->deferredFiles) return;
                
                        foreach ($this->deferredFiles as $obj) {
                Severity: Minor
                Found in EventListener/UploaderListener.php - About 35 mins to fix

                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 propertyRename has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    function propertyRename(PropertyMapping $propertyMapping, $fileName, $params)
                    {
                
                        if (isset($params['use_field_name']) && $params['use_field_name'])
                            return $propertyMapping->getFileDataPropertyName();
                Severity: Minor
                Found in Naming/DefaultDirectoryNamer.php - About 35 mins to fix

                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 preSet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function preSet(FormEvent $event)
                    {
                        $form = $event->getForm();
                        $propertyName = $form->getName();
                
                
                Severity: Minor
                Found in Form/Type/FileTypeBindSubscriber.php - About 25 mins to fix

                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

                Severity
                Category
                Status
                Source
                Language