Completed
Push — master ( fc9b06...645bdc )
by Vitaly
07:44
created

Field::byName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 3

Duplication

Lines 8
Ratio 100 %
Metric Value
dl 8
loc 8
rs 9.4286
cc 2
eloc 3
nc 2
nop 2
1
<?php
2
namespace samsoncms\api;
3
4
/**
5
 * SamsonCMS field table class
6
 * @package samson\cms
7
 */
8
class Field extends \samson\activerecord\field
9
{
10
  /**
11
     * Find field database record by identifier
12
     * @param string $identifier Field identifier
13
     * @param self $return Return self instance
14
     * @return bool|null
15
     */
16 View Code Duplication
    public static function byID($identifier, self & $return = null )
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
Expected 0 spaces between argument "$return" and closing bracket; 1 found
Loading history...
17
    {
18
        // Get field record by identiifer column
19
        $return = static::oneByColumn(new dbQuery(), self::$_primary, $identifier);
20
21
        // If only one argument is passed - return null, otherwise bool
22
        return func_num_args() > 1 ? $return == null : $return;
23
    }
24
25
    /**
26
     * Find field database record by name
27
     * @param string $identifier Field identifier
28
     * @param self $return Return self instance
29
     * @return bool|null
30
     */
31 View Code Duplication
    public static function byName($identifier, self & $return = null )
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
Expected 0 spaces between argument "$return" and closing bracket; 1 found
Loading history...
32
    {
33
        // Get field record by identiifer column
34
        $return = static::oneByColumn(new dbQuery(), self::$_primary, 'Name');
35
36
        // If only one argument is passed - return null, otherwise bool
37
        return func_num_args() > 1 ? $return == null : $return;
38
    }
39
}
40