for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @file
* Contains \TheSportsDb\Entity\Repository\SeasonRepository.
*/
namespace TheSportsDb\Entity\Repository;
* The default SeasonRepository implementation.
*
* @author Jelle Sebreghts
class SeasonRepository extends Repository implements SeasonRepositoryInterface {
protected $entityType = 'season';
* {@inheritdoc}
public function byId($id) {
if (!isset($this->repository[$id])) {
list($name, $league) = explode('|', $id);
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
$factory = $this->entityManager->factory($this->getEntityTypeName());
$this->repository[$id] = $factory->create(
(object) array('id' => $id, 'name' => $name, 'league' => (object) array('id' => $league)),
$this->getEntityTypeName()
);
}
return $this->repository[$id];
public function all() {
// Loading all seasons without any further context is rediculous.
return array();
public function byLeague($leagueId) {
$data = $this->sportsDbClient->doRequest('search_all_seasons.php', array('id' => $leagueId))->seasons;
foreach ($data as &$season) {
$season->idLeague = $leagueId;
return $this->normalizeArray($data);
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.