Completed
Push — feature/ss4-upgrade ( f41a3f )
by
unknown
10:12
created

AddonVendor   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A Authors() 0 4 1
1
<?php
2
3
namespace SilverStripe\Addons\Model;
4
5
use SilverStripe\ORM\DataObject;
6
7
/**
8
 * An add-one vendor, derived from the vendor part of a package name,
9
 */
10
class AddonVendor extends DataObject 
11
{
12
13
	public static $db = [
14
		'Name' => 'Varchar(255)'
15
	];
16
17
	public static $has_many = [
18
		'Addons' => 'SilverStripe\Addons\Model\Addon'
19
	];
20
21
	public function Authors() 
22
	{
23
		return $this->Addons()->relation('Versions')->relation('Authors');
0 ignored issues
show
Documentation Bug introduced by
The method Addons does not exist on object<SilverStripe\Addons\Model\AddonVendor>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
24
	}
25
26
}
27