bravesheep/dogmatist

View on GitHub

Showing 26 of 26 total issues

Builder has 40 functions (exceeds 20 allowed). Consider refactoring.
Open

class Builder
{
    const DEFAULT_MIN = 0;
    const DEFAULT_MAX = 10;

Severity: Minor
Found in src/Builder.php - About 5 hrs to fix

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

        public function sample(Builder $builder, UniqueArrayObject $parent = null)
        {
            $data = new UniqueArrayObject($parent);
            $faker = $this->dogmatist->getFaker();
            foreach ($builder->getFields() as $field) {
    Severity: Minor
    Found in src/Sampler.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

    Field has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Field 
    {
        /**
         * Ignore this field.
         */
    Severity: Minor
    Found in src/Field.php - About 3 hrs to fix

      File Builder.php has 285 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace Bravesheep\Dogmatist;
      use Bravesheep\Dogmatist\Exception\BuilderException;
      
      
      Severity: Minor
      Found in src/Builder.php - About 2 hrs to fix

        File Sampler.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace Bravesheep\Dogmatist;
        
        use Bravesheep\Dogmatist\Exception\SampleException;
        Severity: Minor
        Found in src/Sampler.php - About 2 hrs to fix

          Function setObjectProperty has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              private function setObjectProperty($obj, $key, $value, Builder $builder)
              {
                  if ($value instanceof ReplacableArray) {
                      foreach ($value->data as &$subval) {
                          foreach ($subval->fields as $field) {
          Severity: Minor
          Found in src/Sampler.php - About 2 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

          Function sampleField has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              private function sampleField(Field $field, UniqueArrayObject $data)
              {
                  $faker = $this->dogmatist->getFaker();
                  $type = $field->getType();
                  $value = null;
          Severity: Minor
          Found in src/Sampler.php - About 2 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

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

              private function replaceLinksInObject($obj, Builder $builder)
              {
                  foreach (get_object_vars($obj) as $key => $value) {
                      if ($value instanceof ReplacableArray) {
                          foreach ($value->data as &$subval) {
          Severity: Minor
          Found in src/Sampler.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

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

              public function matchingSample($builder, $callback)
              {
                  if (is_string($builder) && !$this->getLinkManager()->hasUnlimitedSamples($builder)) {
                      foreach ($this->getLinkManager()->samples($builder) as $sample) {
                          if ($callback($sample)) {
          Severity: Minor
          Found in src/Dogmatist.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

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

              private function replaceLinksInArray(array $data, Builder $builder)
              {
                  foreach ($data as $key => &$value) {
                      if ($value instanceof ReplacableArray) {
                          foreach ($value->data as &$subval) {
          Severity: Minor
          Found in src/Sampler.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 makeField has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function makeField(array $mapping, Builder $builder)
              {
                  $field = $mapping['fieldName'];
                  switch ($mapping['type']) {
                      case 'string':
          Severity: Minor
          Found in src/Guesser/DoctrineGuesser.php - About 1 hr to fix

            Function alignArgs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                private function alignArgs(\ReflectionMethod $constructor, array $data, ConstructorBuilder $builder)
                {
                    if ($builder->isPositional()) {
                        $aligned = $data;
                    } else {
            Severity: Minor
            Found in src/Sampler.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 setObjectProperty has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function setObjectProperty($obj, $key, $value, Builder $builder)
                {
                    if ($value instanceof ReplacableArray) {
                        foreach ($value->data as &$subval) {
                            foreach ($subval->fields as $field) {
            Severity: Minor
            Found in src/Sampler.php - About 1 hr to fix

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

                  private function makeField(array $mapping, Builder $builder)
                  {
                      $field = $mapping['fieldName'];
                      switch ($mapping['type']) {
                          case 'string':
              Severity: Minor
              Found in src/Guesser/DoctrineGuesser.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 sample has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function sample(Builder $builder, UniqueArrayObject $parent = null)
                  {
                      $data = new UniqueArrayObject($parent);
                      $faker = $this->dogmatist->getFaker();
                      foreach ($builder->getFields() as $field) {
              Severity: Minor
              Found in src/Sampler.php - About 1 hr to fix

                Method sampleField has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function sampleField(Field $field, UniqueArrayObject $data)
                    {
                        $faker = $this->dogmatist->getFaker();
                        $type = $field->getType();
                        $value = null;
                Severity: Minor
                Found in src/Sampler.php - About 1 hr to fix

                  Method addFieldOfType has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function addFieldOfType($field, $type, $multiple, array $options, Builder $builder)
                      {
                          switch ($type) {
                              case Field::TYPE_FAKE:
                                  $builder->fake($field, $options[0], isset($options[1]) ? $options[1] : []);
                  Severity: Minor
                  Found in src/Guesser/FieldNameGuesser.php - About 1 hr to fix

                    Function addFieldOfType has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function addFieldOfType($field, $type, $multiple, array $options, Builder $builder)
                        {
                            switch ($type) {
                                case Field::TYPE_FAKE:
                                    $builder->fake($field, $options[0], isset($options[1]) ? $options[1] : []);
                    Severity: Minor
                    Found in src/Guesser/FieldNameGuesser.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

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

                        public function fill(Builder $builder)
                        {
                            $manager = null;
                            if (Util::isUserClass($builder->getClass())) {
                                $manager = $this->registry->getManagerForClass($builder->getClass());
                    Severity: Minor
                    Found in src/Guesser/DoctrineGuesser.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

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

                        private function constructObject(\ReflectionClass $refl, Builder $builder)
                        {
                            $constructor = $refl->getConstructor();
                            $obj = null;
                            if (null === $constructor || $constructor->getNumberOfParameters() === 0) {
                    Severity: Minor
                    Found in src/Sampler.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

                    Severity
                    Category
                    Status
                    Source
                    Language