/** * Returns the recommended alias to use in XML. * * This alias is also the mandatory prefix to use when using YAML. * * This convention is to remove the "Extension" postfix from the class * name and then lowercase and underscore the result. So: * * AcmeHelloExtension * * becomes * * acme_hello * * This can be overridden in a sub-class to specify the alias manually. * * @return string The alias * * @throws ehough_iconic_exception_BadMethodCallException When the extension name does not follow conventions */ public function getAlias() { $className = get_class($this); if (substr($className, -9) != 'Extension') { throw new ehough_iconic_exception_BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.'); } $classBaseName = substr(strrchr($className, '\\'), 1, -9); return ehough_iconic_Container::underscore($classBaseName); }
/** * Convert a service id to a valid PHP method name. * * @param string $id * * @return string * * @throws ehough_iconic_exception_InvalidArgumentException */ private function camelize($id) { $name = ehough_iconic_Container::camelize($id); if (!preg_match('/^[a-zA-Z0-9_\\x7f-\\xff]+$/', $name)) { throw new ehough_iconic_exception_InvalidArgumentException(sprintf('Service id "%s" cannot be converted to a valid PHP method name.', $id)); } return $name; }
/** * @internal */ public function getParameterBag() { return $this->_delegate->getParameterBag(); }
/** * Gets all service ids. * * @return array An array of all defined service ids */ public function getServiceIds() { return array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds())); }