/** * @param string $service * @param array $params * @return mixed|object * @throws \InvalidArgumentException */ public function create($service, array $params = array()) { $prefix = substr($service, 0, 9); if ($prefix === 'heystack.' || $prefix === 'heystack?') { $service = substr($service, 9); if ($this->heystackContainer->has($service)) { return $this->heystackContainer->get($service); } elseif ($this->heystackContainer->hasParameter($service)) { return $this->heystackContainer->getParameter($service); } elseif ($prefix === 'heystack?') { return null; } throw new \InvalidArgumentException(sprintf("Requested Heystack service or parameter '%s' doesn't exist", $service)); } else { return parent::create($service, $params); } }