/** * @return string */ public function getType($fqcn = false) { if (true === $fqcn) { return (string) get_class($this); } $className = ClassInfo::getClassNameByInstance($this); $className = substr($className, 4); $className = substr($className, 0, strlen($className) - 7); return $className; }
/** * Returns the name of the Twig extension based on the classname. * * @return string */ public final function getName() { return strtolower(sprintf('twig_ext_%s', ClassInfo::getClassNameByInstance($this))); }
/** * @internal * * @param FixtureInterface $handler * * @return string */ public function getHandlerClassName(FixtureInterface $handler) { return ClassInfo::getClassNameByInstance($handler); }
/** * Get the handler type (generally this will return the class name). * * @param bool $fqcn * * @return string */ public function getType($fqcn = false) { return (string) ($fqcn === true ? ClassInfo::getNamespaceByInstance($this) . '\\' . ClassInfo::getClassNameByInstance($this) : ClassInfo::getClassNameByInstance($this)); }
/** * Helper function for {@see getHandlerByMode} for mode {@see CompilerPassChainInterface::FILTER_MODE_SINGLE}. * * @param array $filteredHandlerCollection * * @throws RuntimeException When passed collection contains more than a single array element. * * @return mixed */ private function getHandlerByModeSingle(array $filteredHandlerCollection) { if (1 !== count($filteredHandlerCollection)) { throw new RuntimeException('More than one handler contained in collection but the chain type "%s" is configured to allow ' . 'only a single handler to meet a given requirement, as passed to "%s::getHandler".', null, null, ClassInfo::getClassNameByInstance($this), get_class($this)); } return array_first($filteredHandlerCollection); }
/** * @return CacheAttendantInterface[] */ protected function getCacheAttendants(array $specific = [], $includeDisabled = false) { $attendants = []; foreach ($this->getCacheRegistrar() as $a) { if ($a->isEnabled() && count($specific) === 0 || in_array(ClassInfo::getClassNameByInstance($a), $specific) || $includeDisabled === true) { $attendants[] = $a; } } return $attendants; }