for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace hiqdev\billing\hiapi\repositories;
use hiapi\components\ConnectionInterface;
use hiapi\query\QueryMutator;
use hiapi\query\Specification;
use yii\db\Query;
class PlanRepository extends \hiapi\repositories\BaseRepository
{
/**
* @var ConnectionInterface
*/
private $db;
* @var PlanFactory
private $planFactory;
* @var PlanHydrator
private $planHydrator;
public function __construct(ConnectionInterface $db, PlanFactory $planFactory, PlanHydrator $planHydrator, array $config = [])
parent::__construct($config);
$this->db = $db;
$this->planFactory = $planFactory;
$this->planHydrator = $planHydrator;
}
public function findAll(Specification $specification)
$mutator = (new QueryMutator((new Query())
->select(['p.obj_id as id', 'p.name'])
->from('tariff p')
))->apply($specification);
$rows = $mutator->getQuery()->createCommand($this->db)->queryAll();
foreach ($specification->requestedRelations as $relation => $todo) {
foreach
This check looks for foreach loops that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.
Consider removing the loop.
// todo...
$plans = $this->planHydrator->hydrateMultiple($this->planFactory->createPrototype(), $rows);
return $plans;
This check looks for
foreach
loops that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.Consider removing the loop.