Prosiłbym Was o code review aplikacji do skracania adresów

https://github.com/selfmadeking/URL-shortener-Symfony-4
private $urlGeneratorService; private $em; public function __construct(UrlGeneratorService $urlGeneratorService, EntityManagerInterface $em) { $this->urlGeneratorService = $urlGeneratorService; $this->em = $em; }
public function userIsAuthorOfList($list) { $urls = $list->getListOfUrls(); $userId = $this->security->getUser(); $userId = $userId->getId(); } $userIdOfUrl = $urls->first()->getUserId(); $userIdOfUrl = $userIdOfUrl->getId(); } return (bool) $userIdOfUrl == $userId; }
$userId = $this->security->getUser(); $userId = $userId->getId(); }
$userIdOfUrl = $urls->first()->getUserId();
return (bool) $userIdOfUrl == $userId;
public function validate($value, Constraint $constraint) { if (null === $value || '' === $value) { return; } throw new UnexpectedValueException($value, 'url'); } $pattern = '/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/'; $this->context->buildViolation($constraint->message) ->setParameter('{{ url }}', $value) ->addViolation(); } }
{ return $val; } return $this->transformObjectToArray($val); } return $this->transformScalarToArray($val); } } { $result = null; $result = $val; $result = $this->transformObjectToArray($val); } else { $result = $this->transformScalarToArray($val); } return $result }
dump($result);
return ($a + $b);
public function doSth($x = null){ if($x){ $y = 0; }else{ $y = $x; } }
public function doSth($x = null){ $y = 0; if($x){ $y = $x; } }
{ $result = null; $result = $val; } $result = $this->transformObjectToArray($val); } if ($result === null) { $result = $this->transformScalarToArray($val); } return $result }
return ($a+$b);
$c = $a+$b; return $c;
if(!$sth)
if($sth == false)
if(!!$sth)
private $urlGeneratorService; private $em; public function __construct(UrlGeneratorService $urlGeneratorService, EntityManagerInterface $em) { $this->urlGeneratorService = $urlGeneratorService; $this->em = $em; }
public function nazwa(?JakiśTypObiektu $obiekt): ?string {}