Victoire /
victoire
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 Victoire\Bundle\UserBundle\Model; |
||
| 4 | |||
| 5 | use Doctrine\ORM\Mapping as ORM; |
||
| 6 | use FOS\UserBundle\Model\User as BaseUser; |
||
| 7 | use Symfony\Component\Serializer\Annotation\Groups; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * Victoire User model. |
||
| 11 | */ |
||
| 12 | class User extends BaseUser implements VictoireUserInterface |
||
| 13 | { |
||
| 14 | use \Gedmo\Timestampable\Traits\TimestampableEntity; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @ORM\Id |
||
| 18 | * @ORM\Column(type="integer") |
||
| 19 | * @ORM\GeneratedValue(strategy="AUTO") |
||
| 20 | */ |
||
| 21 | protected $id; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var string |
||
| 25 | * |
||
| 26 | * @ORM\Column(name="firstname", type="string", length=255, nullable=true) |
||
| 27 | * @Groups({"profile"}) |
||
| 28 | */ |
||
| 29 | protected $firstname; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var string |
||
| 33 | * |
||
| 34 | * @ORM\Column(name="lastname", type="string", length=255, nullable=true) |
||
| 35 | * @Groups({"profile"}) |
||
| 36 | */ |
||
| 37 | protected $lastname; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @var string |
||
| 41 | * |
||
| 42 | * @ORM\Column(name="locale", type="string", length=255, nullable=true) |
||
| 43 | * @Groups({"profile"}) |
||
| 44 | */ |
||
| 45 | protected $locale; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @var \DateTime |
||
| 49 | * |
||
| 50 | * @ORM\Column(name="heartbeat", type="datetime", nullable=true) |
||
| 51 | */ |
||
| 52 | protected $heartbeat; |
||
| 53 | |||
| 54 | protected $pages; |
||
| 55 | protected $articles; |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Get firstname. |
||
| 59 | * |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | public function getFirstname() |
||
| 63 | { |
||
| 64 | return $this->firstname; |
||
|
0 ignored issues
–
show
|
|||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Set firstname. |
||
| 69 | * |
||
| 70 | * @param string $firstname |
||
| 71 | * |
||
| 72 | * @return $this |
||
| 73 | */ |
||
| 74 | public function setFirstname($firstname) |
||
| 75 | { |
||
| 76 | $this->firstname = $firstname; |
||
| 77 | |||
| 78 | return $this; |
||
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * Get lastname. |
||
| 83 | * |
||
| 84 | * @return string |
||
| 85 | */ |
||
| 86 | public function getLastname() |
||
| 87 | { |
||
| 88 | return $this->lastname; |
||
|
0 ignored issues
–
show
The return type of
return $this->lastname; (string) is incompatible with the return type declared by the interface Victoire\Bundle\UserBund...rInterface::getLastname of type Victoire\Bundle\UserBund...l\VictoireUserInterface.
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design. Let’s take a look at an example: class Author {
private $name;
public function __construct($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
}
}
abstract class Post {
public function getAuthor() {
return 'Johannes';
}
}
class BlogPost extends Post {
public function getAuthor() {
return new Author('Johannes');
}
}
class ForumPost extends Post { /* ... */ }
function my_function(Post $post) {
echo strtoupper($post->getAuthor());
}
Our function Loading history...
|
|||
| 89 | } |
||
| 90 | |||
| 91 | /** |
||
| 92 | * Set lastname. |
||
| 93 | * |
||
| 94 | * @param string $lastname |
||
| 95 | * |
||
| 96 | * @return $this |
||
| 97 | */ |
||
| 98 | public function setLastname($lastname) |
||
| 99 | { |
||
| 100 | $this->lastname = $lastname; |
||
| 101 | |||
| 102 | return $this; |
||
| 103 | } |
||
| 104 | |||
| 105 | /** |
||
| 106 | * Get fullName. |
||
| 107 | * |
||
| 108 | * @return string |
||
| 109 | */ |
||
| 110 | public function getFullName() |
||
| 111 | { |
||
| 112 | return $this->firstname.' '.$this->lastname; |
||
| 113 | } |
||
| 114 | |||
| 115 | /** |
||
| 116 | * Get locale. |
||
| 117 | * |
||
| 118 | * @return string |
||
| 119 | */ |
||
| 120 | public function getLocale() |
||
| 121 | { |
||
| 122 | return $this->locale; |
||
|
0 ignored issues
–
show
The return type of
return $this->locale; (string) is incompatible with the return type declared by the interface Victoire\Bundle\UserBund...serInterface::getLocale of type Victoire\Bundle\UserBund...l\VictoireUserInterface.
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design. Let’s take a look at an example: class Author {
private $name;
public function __construct($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
}
}
abstract class Post {
public function getAuthor() {
return 'Johannes';
}
}
class BlogPost extends Post {
public function getAuthor() {
return new Author('Johannes');
}
}
class ForumPost extends Post { /* ... */ }
function my_function(Post $post) {
echo strtoupper($post->getAuthor());
}
Our function Loading history...
|
|||
| 123 | } |
||
| 124 | |||
| 125 | /** |
||
| 126 | * Set locale. |
||
| 127 | * |
||
| 128 | * @param string $locale |
||
| 129 | * |
||
| 130 | * @return $this |
||
| 131 | */ |
||
| 132 | public function setLocale($locale) |
||
| 133 | { |
||
| 134 | $this->locale = $locale; |
||
| 135 | |||
| 136 | return $this; |
||
| 137 | } |
||
| 138 | |||
| 139 | /** |
||
| 140 | * @return \DateTime |
||
| 141 | */ |
||
| 142 | public function getHeartbeat() |
||
| 143 | { |
||
| 144 | return $this->heartbeat; |
||
| 145 | } |
||
| 146 | |||
| 147 | /** |
||
| 148 | * @param \DateTime $heartbeat |
||
| 149 | */ |
||
| 150 | public function setHeartbeat($heartbeat) |
||
| 151 | { |
||
| 152 | $this->heartbeat = $heartbeat; |
||
| 153 | } |
||
| 154 | } |
||
| 155 |
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.
Let’s take a look at an example:
Our function
my_functionexpects aPostobject, and outputs the author of the post. The base classPostreturns a simple string and outputting a simple string will work just fine. However, the child classBlogPostwhich is a sub-type ofPostinstead decided to return anobject, and is therefore violating the SOLID principles. If aBlogPostwere passed tomy_function, PHP would not complain, but ultimately fail when executing thestrtouppercall in its body.