Returns a string output.

@param string            $class
@param string|array|null $options

@return string|array
549431
public static function getOutput($class, $options = null)
    {
        $fakeClass = new $class($options);
        $generatorName = $fakeClass->generatedBy();
        $generator = new $generatorName();
        $generator->setCaller($fakeClass);

        return $generator->generate();
    }
1033849
public static function getParamName($class)
    {
        if (\is_object($class)) {
            $class = \get_class($class);
        }

        $parts = \explode('\\', $class);
        $last = \array_pop($parts);
        $last = \preg_replace('/Query$/', '', $last); // for BoolQuery

        return self::toSnakeCase($last);
    }
1062969
public static function output($data, array $options = [])
    {
        $options = array_merge([
            'trace_offset' => 0,
        ], $options);

        if (!self::$output || !is_string($data)) {
            return;
        }

        if (php_sapi_name() == 'cli') {
            echo str_pad(' DEBUG ', 100, '-', STR_PAD_BOTH);
            echo "\n";
            if (self::$showCalledFrom) {
                echo self::getCalledFrom($options['trace_offset'] + 2);
                echo "\n";
            }
            echo $data;
            echo "\n";
        } else {
            if (self::$showCalledFrom) {
                echo sprintf(self::$style['called_from_format'], self::getCalledFrom($options['trace_offset'] + 2));
            }
            echo sprintf(self::$style['output_format'], $data);
        }
    }
634424
public static function getNamespace($class)
    {
        if (is_object($class) === true) {
            $class = get_class($class);
        }
        foreach (['\\', '_'] as $separator) {
            $pos = strrpos($class, $separator);
            if ($pos !== false) {
                return ltrim(substr($class, 0, $pos), $separator);
            }
        }
        return '';
    }
825838
public function loadClass($class)
    {
        $prefix = $class;

        while (($pos = strrpos($prefix, '\\')) !== false) {
            $prefix = substr($class, 0, $pos + 1);
            $relativeClass = substr($class, $pos + 1);

            $mappedFile = $this->_loadMappedFile($prefix, $relativeClass);
            if ($mappedFile) {
                return $mappedFile;
            }

            $prefix = rtrim($prefix, '\\');
        }

        return false;
    }
619656
private function checkOptGroup($options, $class, $style)
    {
        foreach ($options as $option) {
            // If it is an option group, handle it.
            if (!isset($option['value'])) {
                $result = $this->checkOptGroup($option, $class, $style);
                if ($result) {
                    return $result;
                }

                continue;
            }

            // No option group, check if it is selected.
            if ($this->isSelected($option)) {
                return sprintf(
                    '<input type="hidden" id="ctrl_%s" name="%s" value="%s" /><span%s>%s</span>',
                    $this->strId,
                    $this->strName,
                    StringUtil::specialchars($option['value']),
                    $class . $style,
                    $option['label']
                );
            }
        }

        return null;
    }
444756
public static function loadClass($class)
    {
        if (isset(self::$_classMap[$class]))
            return (bool)require sprintf('%s/%s', self::ROOT_DIR, self::$_classMap[$class]);
        return null;
    }
1287424
public function output($options = array())
    {
        $this->saveLocale();

        $canvas = $this->getCanvas();
        if (is_null($canvas)) {
            return null;
        }

        $output = $canvas->output($options);

        $this->restoreLocale();

        return $output;
    }
1250745
public function input($options = [])
    {
        if (is_string($options)) {
            $options = ['class' => $options];
        }

        $input = new Input($this->expression('input'), $options);

        return $input;
    }
1225971
private function get_file_name_from_class( $class ) {
		if ( 'classmap' === static::$autoload_type ) {
			$filtered_class_name = explode( '\\', $class );
			$class_filename      = end( $filtered_class_name );
			$class_filename      = str_replace( '_', '-', $class_filename );

			return static::$filename_prefix . $class_filename . '.php';
		} else {

			return $this->psr4_get_file_name_from_class( $class );
		}
	}
936775
protected function get_file_name( $class ) {
		if ( $class ) {
			$file   = explode( '\\', $class );
			$file   = strtolower( end( $file ) );
			$file__ = str_replace( '_', '-', $file );
			$files  = array(
				$file . '.php', // File Name With _.
				$file__ . '.php', // File Name With - which is replaced by _.
				'class-' . $file__ . '.php', // File name With Class Prefixed.
				'class_' . $file__ . '.php', // File Name With - which is replaced by _.
			);
			return $files;
		}
		return false;
	}
235915
public function getZendInstance($class, $options)
    {
        if (strpos($class, 'Zend\Filter') === false) {
            $class = "Zend\Filter\\".$class;
        }

        if (! class_exists($class)) {
            throw new InvalidZendFilterException("Could not find or autoload: $class");
        }

        try {
            new \ReflectionMethod($class, 'setOptions');

            $filter = new $class();
            $filter->setOptions($options);

            return $filter;
        } catch (\ReflectionException $e) {
            return new $class($options);
        }
    }
400505
public function newInstance($class = null, $options = [])
    {
        if ($class === null) {
            $class = get_class($this);
        } elseif ($class instanceof self) {
            $class = get_class($class);
        }

        if (is_string($class) && $class[0] != '\\') {
            $class = '\\'.$class;
        }

        if ($this->persistence) {
            return $this->persistence->add($class, $options);
        }

        return new $class($options);
    }
1307394
public static function getClassDescription(string $class, string &$resolvedClass = null): string
    {
        $resolvedClass = $class;
        try {
            $resource = new ClassExistenceResource($class, false);

            // isFresh() will explode ONLY if a parent class/trait does not exist
            $resource->isFresh(0);

            $r = new \ReflectionClass($class);
            $resolvedClass = $r->name;

            if ($docComment = $r->getDocComment()) {
                $docComment = preg_split('#\n\s*\*\s*[\n@]#', substr($docComment, 3, -2), 2)[0];

                return trim(preg_replace('#\s*\n\s*\*\s*#', ' ', $docComment));
            }
        } catch (\ReflectionException $e) {
        }

        return '';
    }
599447
public function dump(array $options = []): string
    {
        $options = array_replace(
            [
                'class' => 'ProjectMatcher',
                'base_class' => Matcher::class,
            ],
            $options
        );

        // trailing slash support is only enabled if we know how to redirect the user
        $interfaces = class_implements($options['base_class']);

        return <<<EOF
<?php

use Gos\Bundle\PubSubRouterBundle\Exception\ResourceNotFoundException;
use Gos\Bundle\PubSubRouterBundle\Router\Route;

/**
 * This class has been auto-generated
 * by the PubSubRouterBundle.
 */
class {$options['class']} extends {$options['base_class']}
{
    public function __construct()
    {
    }

{$this->generateMatchMethod()}
}

EOF;
    }
1146099
public function para($class = null, $text = null, array $options = [])
    {
        $options = optionsParser($options)->tooltip();
        list($text, $options) = $this->addIconToText($text, $options);

        return parent::para($class, (string)$text, $options->toArray());
    }
1084971
public function addClass(array $options = [], $class = null, $key = 'class')
    {
        if (isset($options[$key]) && is_array($options[$key])) {
            $options[$key][] = $class;
        } elseif (isset($options[$key]) && trim($options[$key])) {
            $options[$key] .= ' ' . $class;
        } else {
            $options[$key] = $class;
        }

        return $options;
    }