Example #1
0
 /**
  * Return stations based on request
  *
  * @access protected
  * @param  Source $source
  * @param  StdClass $user
  * @return Array
  */
 protected function _getStations($source, $user = false)
 {
     if ($source->getMultiple() === true) {
         if ($user !== false) {
             #Find by region and user id
             $stations = (new Station())->findByRegionIdAndUserId($source->getRegion(), $user->id);
         } else {
             #Find by region id
             $stations = (new Station())->findByRegionId($source->getRegion());
         }
     } else {
         #Specific station
         $stations = (new Station())->findById($source->getStation());
     }
     return $stations;
 }