Completed
Push — master ( a30fc0...84b57d )
by Gino
01:44
created

ModelAbstract   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 0
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUrl() 0 6 1
getModelUrlParams() 0 1 ?
1
<?php
2
3
namespace GinoPane\BlogTaxonomy\Models;
4
5
use Model;
6
use Cms\Classes\Controller;
7
8
/**
9
 * Class ModelAbstract
10
 *
11
 * @property string $url
12
 *
13
 * @package GinoPane\BlogTaxonomy\Models
14
 */
15
abstract class ModelAbstract extends Model
0 ignored issues
show
Coding Style introduced by
ModelAbstract does not seem to conform to the naming convention (^Abstract|Factory$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
16
{
17
    /**
18
     * Sets the URL attribute with a URL to this object
19
     *
20
     * @param string $pageName
21
     * @param Controller $controller
22
     * @param array $params
23
     *
24
     * @return void
25
     */
26
    public function setUrl($pageName, Controller $controller, array $params = array()): void
27
    {
28
        $params = $this->getModelUrlParams($params);
0 ignored issues
show
Coding Style introduced by
Consider using a different name than the parameter $params. This often makes code more readable.
Loading history...
29
30
        $this->url = $controller->pageUrl($pageName, $params);
31
    }
32
33
    /**
34
     * @param array $params
35
     *
36
     * @return array
37
     */
38
    abstract protected function getModelUrlParams(array $params): array;
39
}
40