/** * Exports a reflected object. * * @param \TokenReflection\Broker $broker Broker instance * @param string $namespace Namespace name * @param boolean $return Return the export instead of outputting it * * @return string|null * @throws \TokenReflection\Exception\RuntimeException If requested parameter doesn't exist. */ public static function export(Broker $broker, $namespace, $return = false) { $namespaceName = $namespace; $namespace = $broker->getNamespace($namespaceName); if (null === $namespace) { throw new Exception\RuntimeException(sprintf('Namespace %s does not exist.', $namespaceName), Exception\RuntimeException::DOES_NOT_EXIST); } if ($return) { return $namespace->__toString(); } echo $namespace->__toString(); }