php-kitchen/yii2-domain

View on GitHub

Showing 8 of 8 total issues

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

abstract class Repository extends Component implements Contracts\Repository {
    use TransactionAccess;
    /**
     * @var array Stores errors which could occur during save process
     */
Severity: Minor
Found in src/DB/Base/Repository.php - About 3 hrs to fix

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

    class EntitiesRepository extends Base\Repository {
        /**
         * @var string data mapper class name. Required to map data from record to entity. Change it in {@link init()} method
         * if you need custom mapper. But be aware - data mapper is internal class and it is strongly advised to not
         * touch this property.
    Severity: Minor
    Found in src/DB/EntitiesRepository.php - About 3 hrs to fix

      Record has 23 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Record extends ActiveRecord implements Contracts\Record, ContainerAware, ServiceLocatorAware, LoggerAware, EntityDataSource {
          use LoggerAccess;
          use ServiceLocatorAccess;
          use ContainerAccess;
          use StaticSelfAccess;
      Severity: Minor
      Found in src/DB/Record.php - About 2 hrs to fix

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

            public function setFlash($message, $params = []): void {
                if (!$this->useFlashMessages || empty($message)) {
                    return;
                }
                $session = $this->session;
        Severity: Minor
        Found in src/Web/Base/Mixins/SessionMessagesManagement.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 getPropertyFromDataSource has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function getPropertyFromDataSource($propertyName) {
                $property = $this->canGet($propertyName) ? $this->dataSource->$propertyName : null;
        
                if ($property instanceof Record && ($repository = $this->findRepositoryForRecord($property))) {
                    $property = $repository->createEntityFromSource($property);
        Severity: Minor
        Found in src/Base/DataMapper.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 updateActionDefinition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function updateActionDefinition($name, $definition) {
                if (is_string($definition) || is_object($definition)) {
                    $this->_actions[$name] = $definition;
                } elseif (is_array($definition)) {
                    if ($this->isDynamicActionDefined($name) && is_array($this->_actions[$name])) {
        Severity: Minor
        Found in src/Web/Mixins/ControllerActionsManagement.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 convertToEntityAttributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function convertToEntityAttributes(): array {
                $entityAttributesMap = $this->getEntityAttributesMap();
                if (empty($entityAttributesMap)) {
                    return $this->getAttributes();
                }
        Severity: Minor
        Found in src/Web/Base/Models/ViewModel.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 current has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function current() {
                $iterator = $this->getQueryResultIterator();
                $value = $iterator->current();
                if ($iterator->each && $value instanceof Contracts\Record) {
                    $entity = $this->getRepository()->createEntityFromSource($value);
        Severity: Minor
        Found in src/DB/SearchResult.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