3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace MCC\SocialCare\Component\User\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity * @ORM\Table(name="user") */ class User implements \Serializable { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") * @var int */ protected $id; /** * @ORM\Column(name="first_name", type="string", nullable=true) * @var string */ protected $firstName; /** * @ORM\Column(name="last_name", type="string", nullable=true) * @var string */ protected $lastName; /** * @ORM\ManyToMany(targetEntity="Role", inversedBy="users", cascade={"persist"}, fetch="EAGER") * @ORM\JoinTable(name="user_roles") * * @var Role[]|Collection */ protected $roles; /** * @ORM\ManyToMany(targetEntity="Group", inversedBy="users", cascade={"persist"}, fetch="EAGER") * @ORM\JoinTable(name="user_groups") * * @var Group[]|Collection */ protected $groups; /** * @ORM\ManyToMany(targetEntity="MCC\SocialCare\Component\Team\Entity\Team", mappedBy="users") * * @var Team[]|Collection */ protected $teams; /** * @ORM\OneToMany(targetEntity="MCC\SocialCare\Component\Team\Entity\Team", mappedBy="manager") * * @var Team[]|Collection */ protected $managedTeams; /** * The cases in which the user is a key worker on. * * @ORM\OneToMany( * targetEntity="MCC\SocialCare\Component\ServiceUserCase\Entity\ServiceUserCase", * mappedBy="keyWorker" * ) * * @var ServiceUserCase[]|Collection */ protected $keyCases; /** * The cases the user is simply involved with. * * @ORM\ManyToMany(targetEntity="MCC\SocialCare\Component\ServiceUserCase\Entity\ServiceUserCase", mappedBy="users") * * @var Team[]|Collection */ protected $cases; /** * The users notifications. * * @ORM\OneToMany( * targetEntity="MCC\SocialCare\Component\Notification\Entity\NotificationMessage", * mappedBy="recipient", * cascade={"persist"} * ) * * @var NotificationMessage[]|Collection */ protected $notifications; public function __construct() { parent::__construct(); $this->roles = new ArrayCollection(); $this->groups = new ArrayCollection(); $this->teams = new ArrayCollection(); $this->managedTeams = new ArrayCollection(); $this->keyCases = new ArrayCollection(); $this->cases = new ArrayCollection(); $this->notifications = new ArrayCollection(); } /** * @return string */ public function getFullName() { return $this->firstName.' '.$this->lastName; } /** * {@inheritdoc} */ public function setFirstName($firstName) { $this->firstName = $firstName; return $this; } /** * {@inheritdoc} */ public function getFirstName() { return $this->firstName; } /** * {@inheritdoc} */ public function setLastName($lastName) { $this->lastName = $lastName; return $this; } /** * {@inheritdoc} */ public function getLastName() { return $this->lastName; } /** * @param string|Role $role * @return User */ public function addRole($role) { if (!$role instanceof Role) { $role = (new Role)->setRole($role); } if (!$this->hasRole($role)) { $this->roles->add($role); } return $this; } /** * @param string|Role $role * @return User */ public function removeRole($role) { if ($role instanceof Role) { $this->roles->removeElement($role); return $this; } foreach ($this->roles as $r) { if ($r->getRole() === $role) { $this->roles->removeElement($r); } } return $this; } /** * @param string|Role $role * @return bool */ public function hasRole($role) { if ($role instanceof Role) { $role = $role->getRole(); } return $this->roles->exists(function ($key, Role $element) use ($role) { return $role === $element->getRole(); }); } /** * @return Role[] */ public function getRoles() { $roles = $this->roles->toArray(); foreach ($this->getGroups() as $group) { $roles = array_merge($roles, $group->getRoles()); } return $roles; } /** * @param GroupInterface $group * @return User */ public function addGroup(GroupInterface $group) { if (!$this->hasGroup($group)) { $this->groups[] = $group; } return $this; } /** * @param GroupInterface $group * @return User */ public function removeGroup(GroupInterface $group) { $this->groups->removeElement($group); return $this; } /** * @param string|GroupInterface $group * @return bool */ public function hasGroup($group) { if ($group instanceof GroupInterface) { return $this->groups->contains($group); } return $this->groups->exists(function ($key, GroupInterface $element) use ($group) { return $group === $element->getName(); }); } /** * @return Collection|Group[] */ public function getGroups() { return $this->groups; } /** * @param Team $team * @return $this */ public function addTeam(Team $team) { if (!$this->hasTeam($team)) { $this->teams->add($team); $team->addUser($this); } return $this; } /** * @param Team $team * @return $this */ public function removeTeam(Team $team) { if ($this->hasTeam($team)) { $this->teams->removeElement($team); $team->removeUser($this); } return $this; } /** * @param Team $team * @return bool */ public function hasTeam(Team $team) { return $this->teams->contains($team); } /** * @return Collection|Team[] */ public function getTeams() { return $this->teams; } /** * @param Team $team * @return $this */ public function addManagedTeam(Team $team) { if (!$this->hasManagedTeam($team)) { $this->managedTeams->add($team); $team->setManager($this); } return $this; } /** * @param Team $team * @return $this */ public function removeManagedTeam(Team $team) { if ($this->hasManagedTeam($team)) { $this->managedTeams->removeElement($team); $team->setManager(null); } return $this; } /** * @param Team $team * @return bool */ public function hasManagedTeam(Team $team) { return $this->managedTeams->contains($team); } /** * @return Collection|Team[] */ public function getManagedTeams() { return $this->managedTeams; } /** * @param ServiceUserCase $keyCase * @return $this */ public function addKeyCase(ServiceUserCase $keyCase) { if (!$this->hasKeyCase($keyCase)) { $this->keyCases->add($keyCase); $keyCase->setKeyWorker($this); } return $this; } /** * @param ServiceUserCase $keyCase * @return $this */ public function removeKeyCase(ServiceUserCase $keyCase) { if ($this->hasKeyCase($keyCase)) { $this->keyCases->removeElement($keyCase); $keyCase->setKeyWorker(null); } return $this; } /** * @param ServiceUserCase $keyCase * @return bool */ public function hasKeyCase(ServiceUserCase $keyCase) { return $this->keyCases->contains($keyCase); } /** * @return Collection|ServiceUserCase[] */ public function getKeyCases() { return $this->keyCases; } /** * @param ServiceUserCase $case * @return $this */ public function addCase(ServiceUserCase $case) { if (!$this->hasCase($case)) { $this->cases->add($case); $case->addUser($this); } return $this; } /** * @param ServiceUserCase $case * @return $this */ public function removeCase(ServiceUserCase $case) { if ($this->hasCase($case)) { $this->cases->removeElement($case); $case->removeUser($this); } return $this; } /** * @param ServiceUserCase $case * @return bool */ public function hasCase(ServiceUserCase $case) { return $this->cases->contains($case); } /** * @return Collection|ServiceUserCase[] */ public function getCases() { return $this->cases; } /** * @param NotificationMessage $message * @return $this */ public function addNotification(NotificationMessage $message) { if (!$this->hasNotification($message)) { $message->setRecipient($this); $this->notifications->add($message); } return $this; } /** * @param NotificationMessage $message * @return $this */ public function removeNotfication(NotificationMessage $message) { if ($this->hasNotification($message)) { $this->notifications->removeElement($message); $message->setRecipient(null); } return $this; } /** * @param NotificationMessage $message * @return bool */ public function hasNotification(NotificationMessage $message) { return $this->notifications->contains($message); } /** * @return Collection|NotificationMessage[] */ public function getNotifications() { return $this->notifications; } /** * Get unread notification messages * * @return Collection|NotificationMessage[] */ public function getUnreadNotifications() { $criteria = Criteria::create() ->where(Criteria::expr()->eq('read', false)); return $this->notifications->matching($criteria); } /** * Serializes the user. * * The serialized data have to contain the fields used by the equals method and the username. * * @return string */ public function serialize() { return serialize(array( $this->password, $this->salt, $this->usernameCanonical, $this->username, $this->expired, $this->locked, $this->credentialsExpired, $this->enabled, $this->id, )); } /** * Unserializes the user. * * @param string $serialized */ public function unserialize($serialized) { $data = unserialize($serialized); // add a few extra elements in the array to ensure that we have enough keys when unserializing // older data which does not include all properties. $data = array_merge($data, array_fill(0, 2, null)); list( $this->password, $this->salt, $this->usernameCanonical, $this->username, $this->expired, $this->locked, $this->credentialsExpired, $this->enabled, $this->id ) = $data; } } var_dump( unserialize('a:4:{i:0;C:41:"MCC\SocialCare\Component\User\Entity\User":206:{a:9:{i:0;s:60:"$2y$15$2m55uqgw1dc0488k0k44kuj5jlsY5zHjNX/WlJ75iKn1NgPX6rcMS";i:1;s:31:"2m55uqgw1dc0488k0k44k0co8wk8csw";i:2;s:10:"superadmin";i:3;s:10:"superadmin";i:4;b:0;i:5;b:0;i:6;b:0;i:7;b:1;i:8;i:12;}}i:1;b:1;i:2;a:2:{i:0;C:41:"MCC\SocialCare\Component\User\Entity\Role":42:{a:2:{i:0;i:3;i:1;s:16:"ROLE_SUPER_ADMIN";}}i:1;r:16;}i:3;a:0:{}}') );

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.40.0060.00918.71
8.3.30.0000.01418.82
8.3.20.0080.00020.29
8.3.10.0000.00823.61
8.3.00.0060.00317.80
8.2.170.0070.00722.96
8.2.160.0070.00720.43
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0080.00021.02
8.2.110.0000.00822.25
8.2.100.0080.00418.09
8.2.90.0000.00818.96
8.2.80.0060.00317.97
8.2.70.0060.00317.38
8.2.60.0080.00017.80
8.2.50.0000.00818.07
8.2.40.0040.00418.09
8.2.30.0030.00618.14
8.2.20.0030.00517.72
8.2.10.0000.00718.09
8.2.00.0040.00417.60
8.1.270.0050.00323.97
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00322.07
8.1.230.0000.01119.16
8.1.220.0000.00817.74
8.1.210.0030.00618.77
8.1.200.0070.00317.35
8.1.190.0050.00317.23
8.1.180.0090.00018.10
8.1.170.0030.00518.37
8.1.160.0080.00021.96
8.1.150.0040.00418.81
8.1.140.0050.00317.29
8.1.130.0030.00317.78
8.1.120.0030.00517.43
8.1.110.0030.00617.31
8.1.100.0030.00517.39
8.1.90.0070.00417.39
8.1.80.0030.00617.43
8.1.70.0000.00717.34
8.1.60.0000.00817.38
8.1.50.0080.00017.43
8.1.40.0000.00717.46
8.1.30.0090.00017.53
8.1.20.0030.00517.41
8.1.10.0050.00217.40
8.1.00.0040.00417.34
8.0.300.0000.00718.77
8.0.290.0070.00016.63
8.0.280.0030.00518.40
8.0.270.0040.00417.25
8.0.260.0070.00017.20
8.0.250.0050.00316.96
8.0.240.0030.00616.99
8.0.230.0000.00716.95
8.0.220.0040.00416.90
8.0.210.0040.00316.88
8.0.200.0060.00016.99
8.0.190.0000.00716.99
8.0.180.0040.00416.87
8.0.170.0080.00016.90
8.0.160.0000.00716.75
8.0.150.0050.00216.84
8.0.140.0000.00716.89
8.0.130.0000.00513.29
8.0.120.0000.00816.86
8.0.110.0080.00016.93
8.0.100.0040.00416.86
8.0.90.0000.00716.89
8.0.80.0090.01316.95
8.0.70.0040.00416.77
8.0.60.0000.00816.82
8.0.50.0000.00816.79
8.0.30.0130.00616.98
8.0.20.0150.01717.40
8.0.10.0060.00317.14
8.0.00.0110.00816.67
7.4.330.0020.00315.09
7.4.320.0030.00316.57
7.4.300.0070.00016.60
7.4.290.0030.00616.71
7.4.280.0040.00416.67
7.4.270.0040.00416.61
7.4.260.0060.00316.59
7.4.250.0060.00316.66
7.4.240.0010.00616.71
7.4.230.0000.00816.82
7.4.220.0090.01016.68
7.4.210.0070.00716.76
7.4.200.0100.00016.73
7.4.160.0040.01216.52
7.4.150.0130.00617.40
7.4.140.0140.00617.86
7.4.130.0080.00916.57
7.4.120.0040.01516.70
7.4.110.0130.01016.77
7.4.100.0100.01016.69
7.4.90.0090.01416.70
7.4.80.0180.00019.39
7.4.70.0150.00916.69
7.4.60.0100.00716.62
7.4.50.0070.00016.80
7.4.40.0060.01016.60
7.4.30.0130.00316.70
7.4.10.0090.00915.35
7.4.00.0070.00615.16
7.3.330.0030.00313.48
7.3.320.0060.00013.34
7.3.310.0000.00816.50
7.3.300.0000.00716.53
7.3.290.0090.00616.54
7.3.280.0070.01016.54
7.3.270.0120.00617.40
7.3.260.0120.00616.47
7.3.250.0120.00816.64
7.3.240.0090.00916.70
7.3.230.0100.00716.54
7.3.210.0120.00616.51
7.3.200.0090.00919.39
7.3.190.0070.01216.52
7.3.180.0060.00916.56
7.3.170.0130.00316.53
7.3.160.0040.01216.51
7.3.130.0060.00915.18
7.3.120.0060.01015.02
7.3.110.0000.01814.70
7.3.100.0000.01514.72
7.3.90.0090.00914.93
7.3.80.0000.00914.92
7.3.70.0040.01114.95
7.3.60.0060.00914.94
7.3.50.0000.01415.10
7.3.40.0060.00614.63
7.3.30.0060.00614.87
7.3.20.0060.00316.55
7.3.10.0040.00816.64
7.3.00.0070.00716.69
7.2.330.0160.00316.72
7.2.320.0160.00016.76
7.2.310.0120.01516.55
7.2.300.0060.01116.79
7.2.290.0040.01316.57
7.2.260.0080.01214.91
7.2.250.0060.01215.09
7.2.240.0070.00715.42
7.2.230.0060.00915.20
7.2.220.0000.01415.07
7.2.210.0090.00614.73
7.2.200.0060.01015.03
7.2.190.0110.00715.16
7.2.180.0030.00914.79
7.2.170.0030.00914.89
7.2.160.0090.00615.17
7.2.150.0050.00516.82
7.2.140.0120.00316.89
7.2.130.0000.01617.01
7.2.120.0090.00616.70
7.2.110.0090.00616.77
7.2.100.0100.00317.12
7.2.90.0100.00616.96
7.2.80.0100.00017.08
7.2.70.0070.01116.89
7.2.60.0020.01116.81
7.2.50.0060.00316.96
7.2.40.0150.00416.76
7.2.30.0030.01416.71
7.2.20.0000.01316.64
7.2.10.0060.01017.10
7.2.00.0040.01118.13
7.1.330.0060.00615.55
7.1.320.0060.00615.74
7.1.310.0070.00715.73
7.1.300.0100.00015.39
7.1.290.0060.00615.79
7.1.280.0060.00615.86
7.1.270.0040.01115.72
7.1.260.0030.01015.67
7.1.250.0000.01415.84
7.1.240.0030.01015.50
7.1.230.0060.00315.84
7.1.220.0060.00615.85
7.1.210.0000.01215.62
7.1.200.0030.00915.66
7.1.190.0030.01415.81
7.1.180.0060.00615.95
7.1.170.0040.00815.42
7.1.160.0060.00915.53
7.1.150.0040.01115.52
7.1.140.0070.00715.77
7.1.130.0060.00815.71
7.1.120.0100.00615.97
7.1.110.0030.01215.79
7.1.100.0050.01116.90
7.1.90.0070.00715.88
7.1.80.0060.00915.55
7.1.70.0060.00516.23
7.1.60.0070.01017.62
7.1.50.0080.01116.42
7.1.40.0030.01115.63
7.1.30.0000.00915.84
7.1.20.0000.00915.88
7.1.10.0030.00815.82
7.1.00.0050.04219.03
7.0.330.0030.01015.52
7.0.320.0040.00815.46
7.0.310.0090.00315.16
7.0.300.0080.00415.51
7.0.290.0000.01015.36
7.0.280.0070.01015.39
7.0.270.0110.00715.26
7.0.260.0030.01015.39
7.0.250.0000.01215.51
7.0.240.0000.01015.59
7.0.230.0030.01015.26
7.0.220.0060.00315.54
7.0.210.0090.00615.52
7.0.200.0030.00616.17
7.0.190.0110.00015.56
7.0.180.0030.01115.43
7.0.170.0030.01015.11
7.0.160.0120.00015.14
7.0.150.0000.01415.51
7.0.140.0100.03618.75
7.0.130.0130.00015.54
7.0.120.0000.01415.38
7.0.110.0000.01415.47
7.0.100.0030.02817.74
7.0.90.0020.02817.76
7.0.80.0050.04317.70
7.0.70.0060.04217.79
7.0.60.0100.04017.76
7.0.50.0050.04517.80
7.0.40.0030.02816.84
7.0.30.0080.02116.76
7.0.20.0050.02816.86
7.0.10.0020.02716.88
7.0.00.0030.02516.83
5.6.400.0000.01614.25
5.6.390.0000.01514.67
5.6.380.0090.00314.67
5.6.370.0100.00314.24
5.6.360.0060.00614.61
5.6.350.0120.00614.55
5.6.340.0070.00314.04
5.6.330.0070.01014.76
5.6.320.0030.01314.13
5.6.310.0060.00314.45
5.6.300.0000.01414.77
5.6.290.0070.00714.11
5.6.280.0120.03317.78
5.6.270.0070.00414.23
5.6.260.0060.00314.36
5.6.250.0090.03517.54
5.6.240.0060.04317.54
5.6.230.0080.05017.64
5.6.220.0030.04017.68
5.6.210.0030.04817.47
5.6.200.0050.04817.65
5.6.190.0050.02817.74
5.6.180.0020.02817.75
5.6.170.0050.02517.77
5.6.160.0070.02317.65
5.6.150.0060.02317.72
5.6.140.0050.03118.02
5.6.130.0080.04417.69
5.6.120.0050.02617.85
5.6.110.0020.02917.86
5.6.100.0070.02517.69
5.6.90.0030.02417.71
5.6.80.0050.02117.48
5.6.70.0090.01717.40
5.6.60.0020.02617.53
5.6.50.0030.02517.47
5.6.40.0070.02017.56
5.6.30.0030.02717.53
5.6.20.0070.02217.47
5.6.10.0020.02117.40
5.6.00.0100.01817.40
5.5.380.0100.03817.49
5.5.370.0070.02617.42
5.5.360.0070.04317.39
5.5.350.0060.03517.56
5.5.340.0060.04817.50
5.5.330.0050.02517.53
5.5.320.0100.01917.69
5.5.310.0030.02617.62
5.5.300.0090.04117.79
5.5.290.0030.03317.70
5.5.280.0080.02217.60
5.5.270.0110.02017.58
5.5.260.0020.02617.63
5.5.250.0050.02517.41
5.5.240.0020.02517.23
5.5.230.0140.01917.30
5.5.220.0050.01917.19
5.5.210.0050.02317.28
5.5.200.0030.02717.23
5.5.190.0050.02417.32
5.5.180.0000.02317.32
5.5.170.0100.00614.33
5.5.160.0050.02217.41
5.5.150.0030.02317.29
5.5.140.0030.02017.20
5.5.130.0030.02817.38
5.5.120.0030.04517.41
5.5.110.0020.03217.36
5.5.100.0100.01717.36
5.5.90.0030.02517.33
5.5.80.0080.02317.19
5.5.70.0050.02317.26
5.5.60.0050.03017.21
5.5.50.0090.03817.21
5.5.40.0100.02717.19
5.5.30.0080.03817.07
5.5.20.0080.02817.18
5.5.10.0100.04117.05
5.5.00.0050.03317.14
5.4.450.0060.02416.55
5.4.440.0080.02116.49
5.4.430.0050.02916.47
5.4.420.0030.02316.49
5.4.410.0040.02116.34
5.4.400.0030.02316.39
5.4.390.0060.02116.35
5.4.380.0030.02216.32
5.4.370.0000.02416.32
5.4.360.0060.02416.41
5.4.350.0070.01616.28
5.4.340.0020.02716.34
5.4.330.0030.00713.58
5.4.320.0050.01716.28
5.4.310.0030.02316.28
5.4.300.0020.02316.31
5.4.290.0090.02116.31
5.4.280.0050.04016.38
5.4.270.0090.01616.36
5.4.260.0070.03016.40
5.4.250.0050.02216.36
5.4.240.0060.02116.40
5.4.230.0000.03116.40
5.4.220.0100.03716.32
5.4.210.0080.02716.36
5.4.200.0080.02016.31
5.4.190.0050.04116.35
5.4.180.0050.03116.35
5.4.170.0030.03616.31
5.4.160.0100.03116.22
5.4.150.0030.04016.36
5.4.140.0030.04314.99
5.4.130.0030.04115.07
5.4.120.0000.04315.03
5.4.110.0090.02215.00
5.4.100.0060.03015.03
5.4.90.0050.02214.96
5.4.80.0060.03615.06
5.4.70.0030.03815.05
5.4.60.0060.02515.01
5.4.50.0050.04114.97
5.4.40.0100.03614.97
5.4.30.0050.03715.04
5.4.20.0050.03015.05
5.4.10.0090.03814.97
5.4.00.0100.03414.71
5.3.290.0010.01814.10
5.3.280.0020.03214.13
5.3.270.0080.03414.08
5.3.260.0020.04014.09
5.3.250.0070.02214.12
5.3.240.0020.04014.11
5.3.230.0070.02814.09
5.3.220.0050.02514.10
5.3.210.0070.03514.04
5.3.200.0110.03814.13
5.3.190.0030.02914.11
5.3.180.0050.03014.11
5.3.170.0040.04214.06
5.3.160.0030.04014.04
5.3.150.0090.02914.12
5.3.140.0050.04014.08
5.3.130.0070.04014.06
5.3.120.0020.04114.08
5.3.110.0100.02014.08
5.3.100.0070.03713.89
5.3.90.0050.03313.80
5.3.80.0070.03913.85
5.3.70.0050.03913.79
5.3.60.0050.03813.87
5.3.50.0050.04213.82
5.3.40.0020.02713.78
5.3.30.0040.02113.72
5.3.20.0080.02813.68
5.3.10.0070.03213.66
5.3.00.0050.03513.58

preferences:
50.96 ms | 400 KiB | 5 Q