hiqdev /
hidev
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | /* |
||
| 4 | * Task runner, code generator and build tool for easier continuos integration |
||
| 5 | * |
||
| 6 | * @link https://github.com/hiqdev/hidev |
||
| 7 | * @package hidev |
||
| 8 | * @license BSD-3-Clause |
||
| 9 | * @copyright Copyright (c) 2014-2016, HiQDev (http://hiqdev.com/) |
||
| 10 | */ |
||
| 11 | |||
| 12 | namespace hidev\controllers; |
||
| 13 | |||
| 14 | use hidev\helpers\Helper; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Package part of the config. |
||
| 18 | */ |
||
| 19 | class PackageController extends CommonController |
||
| 20 | { |
||
| 21 | use \hiqdev\yii2\collection\ObjectTrait; |
||
| 22 | |||
| 23 | public function getYears() |
||
| 24 | { |
||
| 25 | $cur = (integer) date('Y'); |
||
| 26 | $old = (integer) $this->year; |
||
|
0 ignored issues
–
show
|
|||
| 27 | |||
| 28 | return ($old && $old < $cur ? $this->year . '-' : '') . $cur; |
||
|
0 ignored issues
–
show
The property
year does not exist on object<hidev\controllers\PackageController>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 29 | } |
||
| 30 | |||
| 31 | public function getLicense() |
||
| 32 | { |
||
| 33 | return $this->getItem('license') ?: $this->takeVendor()->license ?: 'No license'; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function getIssues() |
||
| 37 | { |
||
| 38 | return $this->getItem('issues') ?: ($this->source . '/issues'); |
||
|
0 ignored issues
–
show
The property
source does not exist on object<hidev\controllers\PackageController>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 39 | } |
||
| 40 | |||
| 41 | public function getWiki() |
||
| 42 | { |
||
| 43 | return $this->getItem('wiki') ?: ($this->source . '/wiki'); |
||
|
0 ignored issues
–
show
The property
source does not exist on object<hidev\controllers\PackageController>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 44 | } |
||
| 45 | |||
| 46 | public function getKeywords() |
||
| 47 | { |
||
| 48 | return Helper::csplit($this->getItem('keywords')); |
||
| 49 | } |
||
| 50 | |||
| 51 | public function getFullName() |
||
| 52 | { |
||
| 53 | return $this->getItem('fullName') ?: ($this->takeVendor()->name . '/' . $this->name); |
||
|
0 ignored issues
–
show
The property
name does not exist on object<hidev\controllers\PackageController>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 54 | } |
||
| 55 | |||
| 56 | public function getSource() |
||
| 57 | { |
||
| 58 | return $this->getItem('source') ?: ('https://github.com/' . $this->takeGoal('github')->name); |
||
| 59 | } |
||
| 60 | |||
| 61 | public function getNamespace() |
||
| 62 | { |
||
| 63 | return $this->getItem('namespace') ?: $this->getPackageManager()->namespace ?: self::defaultNamespace($this->takeVendor()->name, $this->name); |
||
|
0 ignored issues
–
show
The property
name does not exist on object<hidev\controllers\PackageController>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 64 | } |
||
| 65 | |||
| 66 | public static function defaultNamespace($vendor, $package) |
||
| 67 | { |
||
| 68 | return preg_replace('/[^a-zA-Z0-9\\\\]+/', '', $vendor . strtr("-$package", '-', '\\')); |
||
| 69 | } |
||
| 70 | |||
| 71 | public function getSrc() |
||
| 72 | { |
||
| 73 | return $this->rawItem('src') ?: 'src'; |
||
| 74 | } |
||
| 75 | |||
| 76 | public function getHomepage() |
||
| 77 | { |
||
| 78 | return $this->getItem('homepage') ?: $this->getSource(); |
||
| 79 | } |
||
| 80 | |||
| 81 | public function getForum() |
||
| 82 | { |
||
| 83 | return $this->getItem('forum') ?: $this->takeVendor()->forum; |
||
| 84 | } |
||
| 85 | |||
| 86 | public function getLabel() |
||
| 87 | { |
||
| 88 | return $this->getItem('label') ?: $this->getHeadline() ?: Helper::id2camel($this->name); |
||
|
0 ignored issues
–
show
The property
name does not exist on object<hidev\controllers\PackageController>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 89 | } |
||
| 90 | |||
| 91 | public function getTitle() |
||
| 92 | { |
||
| 93 | return $this->getItem('title') ?: Helper::titleize($this->name); |
||
|
0 ignored issues
–
show
The property
name does not exist on object<hidev\controllers\PackageController>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 94 | } |
||
| 95 | |||
| 96 | public function getHeadline() |
||
| 97 | { |
||
| 98 | return $this->getItem('headline'); |
||
| 99 | } |
||
| 100 | |||
| 101 | public function getDescription() |
||
| 102 | { |
||
| 103 | return $this->getItem('description'); |
||
| 104 | } |
||
| 105 | |||
| 106 | public function getRepositoryUrl($file) |
||
| 107 | { |
||
| 108 | return 'https://github.com/' . $this->getFullName() . '/blob/master/' . $file; |
||
| 109 | } |
||
| 110 | public function getAuthors() |
||
| 111 | { |
||
| 112 | return $this->getItem('authors') ?: $this->takeVendor()->authors; |
||
| 113 | } |
||
| 114 | |||
| 115 | /** |
||
| 116 | * Composer for the moment. |
||
| 117 | * To be changed to get actual Package Manager. |
||
| 118 | */ |
||
| 119 | public function getPackageManager() |
||
| 120 | { |
||
| 121 | return $this->takeGoal('composer'); |
||
| 122 | } |
||
| 123 | |||
| 124 | public function hasRequireAny($package) |
||
| 125 | { |
||
| 126 | return $this->hasRequire($package) || $this->hasRequireDev($package); |
||
| 127 | } |
||
| 128 | |||
| 129 | public function hasRequire($package) |
||
| 130 | { |
||
| 131 | $conf = $this->getPackageManager()->getConfiguration(); |
||
| 132 | return array_key_exists($package, $conf->getRequire()); |
||
| 133 | } |
||
| 134 | |||
| 135 | public function hasRequireDev($package) |
||
| 136 | { |
||
| 137 | $conf = $this->getPackageManager()->getConfiguration(); |
||
| 138 | return array_key_exists($package, $conf->getRequireDev()); |
||
| 139 | } |
||
| 140 | } |
||
| 141 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.