Skip to content

Instantly share code, notes, and snippets.

@igorw
Last active August 29, 2015 14:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igorw/3676d83a4022695efb48 to your computer and use it in GitHub Desktop.
Save igorw/3676d83a4022695efb48 to your computer and use it in GitHub Desktop.
Code generated using a markov chain. Input is the symfony code base. Markov transitions use 18-grams, and there is a `php -l` check. DISCLAIMER: These files are generated! Run them at your own risk!
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* @see Symfony\Component\HttpFoundation;
/**
* Request represents an HTTP request from an Apache server.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class AccessMap implements AccessMapInterface
{
private $container;
private $sourceId;
public function __construct($debug)
{
$this->debug = (bool) $debug;
}
/**
* {@inheritdoc}
*/
public function setFile($file)
{
return new YamlFileLoader($file);
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Translation\Loader;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\CssSelector\CssSelector;
/**
* Crawler eases navigation of a list of \DOMElement objects.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Exception;
/**
* LengthRequiredHttpException.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*/
class ConfigDumpReferenceCommand extends AbstractConfigCommand
{
/**
* {@inheritdoc}
*/
public function hasDefault($name)
{
return true;
}
/**
* Restarts the client.
*
* It is only ever called once when the cache is empty.
*
* @param array $a The result of the previous cast for chained casters.
* @param Stub $stub The Stub for the casted resource.
* @param string $blockName The name of the validated property
* @param array $options An array of options
* @param array $options An array of options
*
* @return RouteCollection A RouteCollection instance
*
* @api
*/
public function getSpecificity()
{
return 'en';
}
/**
* Normalizes a version string to the number of components to compare. Pass
* Use getPlural() instead
*/
public function get($name, $default = null)
{
return new FormView($parent);
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\Templating\Loader;
use Symfony\Component\Templating\TemplateNameParserInterface;
use Symfony\Component\Security\Core\Event;
use Symfony\Component\HttpKernel\EventListener;
use Symfony\Component\Form\Exception;
class ErrorMappingException extends ValidatorException
{
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Csrf\CsrfToken;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Templating\Asset\UrlPackage;
/**
* AssetsHelper helps manage asset URLs.
*
* Usage:
*
* <code>
* <img src="<?php echo $view['assets']->getUrl('foo.png') ?>" />
* </code>
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
abstract class HttpCache extends BaseHttpCache
{
protected $logger;
/**
* Constructor
*
* @param string $mimeType The type of the file as provided by PHP
* @param int $size The file size
* @param int $error The error constant of the upload (one of PHP's UPLOAD_ERR_XXX constant provided by the uploader.
*
* @var int
*/
const MARKER = '__CG__';
/**
* Length of the proxy marker
*
* @var int
*/
private $lastCommit;
/**
* Downloads the ICU data for the given version.
*
* @param string $originDir The origin directory
* $mask
* @param string $strategy if null the strategy should not be changed
*/
public function onBind(FormEvent $event)
{
$this->onSubmit($event);
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Profiler;
/**
* ProfilerStorageInterface.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine\DependencyInjection;
use Symfony\Component\DependencyInjection\Alias;
/**
* Represents a "<selector>[<namespace>|<attribute> <operator> <value>]" node.
*
* This component is a port of the Python cssselector library,
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*/
class InternalErrorException extends ParseException implements ExceptionInterface
{
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\CompilerPass;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
/**
* A SVN repository containing ICU data.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class IntlTestHelper
{
/**
* Constructor.
*
* @param string $option The option name
*
* @return mixed The initial form data.
*/
public function hasAccelerator()
{
return array_key_exists($name, $this->options);
}
/**
* {@inheritdoc}
*/
public function getRequest()
{
return $this->name;
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\CacheWarmer\CacheWarmer;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationDumperPass;
use Symfony\Bundle\FrameworkBundle\Command;
use Symfony\Bundle\FrameworkBundle\Templating\Helper;
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
/**
* Takes care of converting the input from a list of checkboxes to a correctly
* indexed array.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class Issn extends Constraint
{
public $message = 'This value should not be blank.';
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*/
class LogoutListener implements ListenerInterface
{
private $securityContext;
private $options;
private $lastError = JSON_ERROR_NONE;
public function getProcess()
{
if (0 === count($this->modelData) ||
// arrays, countables
0 === count($this->modelData) ||
// traversables that are not countable
($this->modelData instanceof \Traversable && $data instanceof \ArrayAccess)) {
throw new \InvalidArgumentException(sprintf($errorMessage, $value));
}
rewind($dump);
return stream_get_contents($dump);
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command;
use Symfony\Component\Console\Helper\TableHelper;
use Symfony\Component\Console\Helper\DescriptorHelper as BaseDescriptorHelper;
/**
* @author Jean-François Simon <contact@jfsimon.fr>
*/
class MarkdownDescriptor extends Descriptor
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'exception';
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Exception\InvalidArgumentException;
use Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpFoundation\Request;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
* MessageDataCollector of SwiftmailerBundle instead.
*/
class MessageDataCollector extends DataCollector
{
/**
* @var string
*/
protected $shell;
/**
* Constructor.
*
* @param string $method
*
* @api
*/
public function setFactory($factory)
{
if (isset($this->nodes[$id]) && $this->nodes[$id]->getValue() === $value) {
return $return;
}
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapper;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\Event;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
/**
* Data provider for currency-related data.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class Optional extends Existence
{
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Process\Exception\LogicException;
/**
* Holds read-only parameters.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\ExpressionLanguage\ParsedExpression;
/**
* SimpleXMLElement class.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\TwigBundle\Loader;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @api
*/
class PhpDumper extends Dumper
{
private $dumper;
/**
* Constructs a metadata for the given class exists in the cache
*
* @throws \RuntimeException When the argument does not exist
*
* @api
*/
public function removeAdapters()
{
$this->locale = $locale;
}
/**
* Returns an array of values to use as request attributes.
*
* @param array $attributes The token attributes
*/
public function setTimeZone($timeZone)
{
return $this->bundles;
}
/**
* {@inheritdoc}
*/
public function getDigits($key, $default = '', $deep = false)
{
if (null !== $this->securityContext->getToken()) {
$session->set('_profiler_search_ip');
$methodXML->appendChild(new \DOMText($method));
}
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Constraints;
/**
* @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class PropertyAccessorBuilder
{
/**
* @var Transformer[]
*/
private $tokenizer;
/**
* Constructor.
*
* @param TemplateFinderInterface $finder The template paths cache warmer
*/
public function __construct(EngineInterface $engine, array $defaultThemes = array())
{
parent::__construct($message, $code, $previous, $path);
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\Validator\Constraint;
/**
* @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*
* @author Antonio J. García Lagar <aj@garcialagar.es>
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @api
*/
class RuntimeException extends RuntimeException
{
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*/
class SecurityBundle extends Bundle
{
public function getFunctions()
{
return $this->scopeChildren;
}
/**
* Adds a command object.
*
* If a class has a group sequence attached, that sequence replaces the
* "Default" group. When validating that class in the "Default" group, the
* group sequence is used instead, but still the "Default" group should be
* cascaded to other objects.
*
* @return string
*/
protected function instantiateNode()
{
return new FloatNode($this->name, $this->parent, $this->values);
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\AbstractType;
use Symfony\Component\CssSelector\Parser\Shortcut;
use Symfony\Component\Config\Definition\Builder;
/**
* This class builds validation conditions.
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
abstract class SessionListener implements EventSubscriberInterface
{
private $translator;
/**
* Constructor.
*
* @param string $class A class name
*
* @var ClassMetadata[]
*/
protected $loadedAcls = array();
protected $options;
protected $defaultOptions = array(
'positive' => 9223372036854775807,
'negative' => -2147483648,
);
/**
* {@inheritdoc}
*/
public function getMetadataFactory()
{
throw new BadMethodCallException('Buttons do not support event listeners.');
}
/**
* Unsupported method.
*
* This method implements a fluent interface.
*
* @return string The prompt
*/
protected function getDumpHeader()
{
$this->mask = 0;
return $this;
}
/**
* Sets the error message for invalid values.
*
* @param array $server The server parameters (HTTP headers are referenced with a HTTP_ prefix as PHP does)
* @param string $content
* @param string $charset Character set
*
* @api
*/
public function __construct($name, $compiler, $evaluator)
{
$this->namespaceFallbacks[] = $dir;
}
/**
* Returns the role.
*
* This method uses the mime type as guessed by getMimeType()
* to guess the file extension.
*
* @return XPathExpr
*/
public function setPadType($padType)
{
parent::__construct($message);
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*/
class Store implements StoreInterface
{
protected $container;
protected $rootDir;
protected $charset = 'UTF-8';
protected $cache = array();
/** @var string */
protected $input;
/** @var bool */
private $ptyMode;
/** @var bool */
private $disableOutput;
public function __construct()
{
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*/
class TemplateCacheCacheWarmer implements CacheWarmerInterface
{
protected $container;
protected $finder;
protected $locator;
/**
* Constructor.
*
* @param Connection $connection
*/
public function isDisabled()
{
if (null === $this->startTime) {
throw new \LogicException(sprintf('Profile with token "%s" does not exist.', $token));
}
$loader = null === $this->resolver->resolve($resource, $type);
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Shortcut\EmptyStringParser;
use Symfony\Component\CssSelector\Parser\TokenStream;
use Symfony\Component\CssSelector\Node;
use Symfony\Component\CssSelector\Node\SelectorNode;
/**
* CSS selector parser interface.
*
* This component is a port of the Python cssselector library,
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*/
class Tokenizer
{
/**
* @var \Memcache Memcache driver.
*
* @param array $options The options used for the configuration.
*/
public function addNodes(array $nodes)
{
foreach ($namedCookies as $cookie) {
$entry->headers->remove('Date');
return;
}
if (null === $roundingMode) {
$this->response->headers->set($header, $content);
unlink($file);
}
return $dateTime->format($format);
}
/**
* Gets the URI associated with this link.
*
* @return string The answer
*
* @throws BadMethodCallException When this ContainerBuilder is frozen
*
* @api
*/
public function getName()
{
return 'process';
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine\Form\Type;
use Doctrine\Common\Persistence\ManagerRegistry;
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Config\Definition;
/**
* This class is the entry point for Symfony global variables in Twig templates.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class TransChoiceTokenParser extends TransTokenParser
{
/**
* Parses a YAML string to a PHP value.
*
* @param string|null $type The resource type or null if unknown
*
* @return LoaderInterface|false The loader or false if none is able to load the resource
*/
public function screamAt($levels, $replace = false)
{
return $this->command;
}
public function evaluate($functions, $values)
{
return $this;
}
/**
* Sets a closure marking the value as invalid at validation time.
*
* @return mixed The parameter value
*
* @return Request A Request instance
* @param LoaderInterface $loader A LoaderInterface instance
*
* @throws AuthenticationServiceException
*/
public function getIterator()
{
return new \ArrayIterator($this->all());
}
}
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*/
class TwigEnvironmentPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$compiler = $container->getCompiler();
$this->formatter = $this->compiler->getLoggingFormatter();
$this->setHttpsPort($request->isSecure() ? $sslId : $httpId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment