timegridio /
concierge
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Timegridio\Concierge\Models; |
||
| 4 | |||
| 5 | use Illuminate\Database\Eloquent\Model as EloquentModel; |
||
| 6 | |||
| 7 | class Preference extends EloquentModel |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * [$fillable description]. |
||
| 11 | * |
||
| 12 | * @var [type] |
||
| 13 | */ |
||
| 14 | protected $fillable = ['key', 'value', 'type']; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * [getDefault description]. |
||
| 18 | * |
||
| 19 | * @param \Timegridio\Concierge\Traits\Preferenceable $model [description] |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 20 | * @param [type] $key [description] |
||
|
0 ignored issues
–
show
The doc-type
[type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 21 | * |
||
| 22 | * @return [type] [description] |
||
|
0 ignored issues
–
show
The doc-type
[type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 23 | */ |
||
| 24 | 4 | public static function getDefault($model, $key) |
|
| 25 | { |
||
| 26 | 4 | $class = get_class($model); |
|
| 27 | 4 | $value = config("preferences.{$class}.{$key}.value"); |
|
| 28 | 4 | $type = config("preferences.{$class}.{$key}.type"); |
|
| 29 | |||
| 30 | 4 | return new self([ |
|
| 31 | 4 | 'key' => $key, |
|
| 32 | 4 | 'value' => $value, |
|
| 33 | 4 | 'type' => $type, |
|
| 34 | 4 | 'preferenceable_type' => $class, |
|
| 35 | 4 | 'preferenceable_id' => $model, |
|
| 36 | ]); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * [question description]. |
||
| 41 | * |
||
| 42 | * @return [type] [description] |
||
|
0 ignored issues
–
show
The doc-type
[type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 43 | */ |
||
| 44 | public function question() |
||
| 45 | { |
||
| 46 | return trans("preferences.{$this->preferenceable_type}.question.{$this->key}"); |
||
|
0 ignored issues
–
show
The property
preferenceable_type does not exist on object<Timegridio\Concierge\Models\Preference>. 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...
The property
key does not exist on object<Timegridio\Concierge\Models\Preference>. 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...
|
|||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * [help description]. |
||
| 51 | * |
||
| 52 | * @return [type] [description] |
||
|
0 ignored issues
–
show
The doc-type
[type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 53 | */ |
||
| 54 | public function help() |
||
| 55 | { |
||
| 56 | return trans("preferences.{$this->preferenceable_type}.help.{$this->key}"); |
||
|
0 ignored issues
–
show
The property
preferenceable_type does not exist on object<Timegridio\Concierge\Models\Preference>. 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...
The property
key does not exist on object<Timegridio\Concierge\Models\Preference>. 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...
|
|||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * [scopeForKey description]. |
||
| 61 | * |
||
| 62 | * @param [type] $query [description] |
||
|
0 ignored issues
–
show
The doc-type
[type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 63 | * @param [type] $key [description] |
||
|
0 ignored issues
–
show
The doc-type
[type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 64 | * |
||
| 65 | * @return [type] [description] |
||
|
0 ignored issues
–
show
The doc-type
[type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. Loading history...
|
|||
| 66 | */ |
||
| 67 | 5 | public function scopeForKey($query, $key) |
|
| 68 | { |
||
| 69 | 5 | return $query->where('key', $key); |
|
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Value getter. |
||
| 74 | * |
||
| 75 | * @return mixed |
||
| 76 | */ |
||
| 77 | 5 | public function value() |
|
| 78 | { |
||
| 79 | 5 | return $this->value; |
|
|
0 ignored issues
–
show
The property
value does not exist on object<Timegridio\Concierge\Models\Preference>. 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...
|
|||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Type getter. |
||
| 84 | * |
||
| 85 | * @return string |
||
| 86 | */ |
||
| 87 | 5 | public function type() |
|
| 88 | { |
||
| 89 | 5 | return $this->type; |
|
|
0 ignored issues
–
show
The property
type does not exist on object<Timegridio\Concierge\Models\Preference>. 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...
|
|||
| 90 | } |
||
| 91 | } |
||
| 92 |