Skip to content

Commit

Permalink
Include copy of Symfony routing component, and don't use composer
Browse files Browse the repository at this point in the history
  • Loading branch information
bartv2 committed Oct 27, 2012
1 parent 8a3eda1 commit c1c7653
Show file tree
Hide file tree
Showing 44 changed files with 4,037 additions and 22 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,3 @@ nbproject
# WebFinger
.well-known
/.buildpath
3rdparty/autoload.php
3rdparty/composer/
3rdparty/symfony/
composer.lock
Binary file removed 3rdparty/bin/composer
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Routing\Annotation;

/**
* Annotation class for @Route().
*
* @Annotation
*
* @author Fabien Potencier <[email protected]>
*/
class Route
{
private $pattern;
private $name;
private $requirements;
private $options;
private $defaults;

/**
* Constructor.
*
* @param array $data An array of key/value parameters.
*/
public function __construct(array $data)
{
$this->requirements = array();
$this->options = array();
$this->defaults = array();

if (isset($data['value'])) {
$data['pattern'] = $data['value'];
unset($data['value']);
}

foreach ($data as $key => $value) {
$method = 'set'.$key;
if (!method_exists($this, $method)) {
throw new \BadMethodCallException(sprintf("Unknown property '%s' on annotation '%s'.", $key, get_class($this)));
}
$this->$method($value);
}
}

public function setPattern($pattern)
{
$this->pattern = $pattern;
}

public function getPattern()
{
return $this->pattern;
}

public function setName($name)
{
$this->name = $name;
}

public function getName()
{
return $this->name;
}

public function setRequirements($requirements)
{
$this->requirements = $requirements;
}

public function getRequirements()
{
return $this->requirements;
}

public function setOptions($options)
{
$this->options = $options;
}

public function getOptions()
{
return $this->options;
}

public function setDefaults($defaults)
{
$this->defaults = $defaults;
}

public function getDefaults()
{
return $this->defaults;
}
}
134 changes: 134 additions & 0 deletions 3rdparty/symfony/routing/Symfony/Component/Routing/CompiledRoute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Routing;

/**
* CompiledRoutes are returned by the RouteCompiler class.
*
* @author Fabien Potencier <[email protected]>
*/
class CompiledRoute
{
private $route;
private $variables;
private $tokens;
private $staticPrefix;
private $regex;

/**
* Constructor.
*
* @param Route $route A original Route instance
* @param string $staticPrefix The static prefix of the compiled route
* @param string $regex The regular expression to use to match this route
* @param array $tokens An array of tokens to use to generate URL for this route
* @param array $variables An array of variables
*/
public function __construct(Route $route, $staticPrefix, $regex, array $tokens, array $variables)
{
$this->route = $route;
$this->staticPrefix = $staticPrefix;
$this->regex = $regex;
$this->tokens = $tokens;
$this->variables = $variables;
}

/**
* Returns the Route instance.
*
* @return Route A Route instance
*/
public function getRoute()
{
return $this->route;
}

/**
* Returns the static prefix.
*
* @return string The static prefix
*/
public function getStaticPrefix()
{
return $this->staticPrefix;
}

/**
* Returns the regex.
*
* @return string The regex
*/
public function getRegex()
{
return $this->regex;
}

/**
* Returns the tokens.
*
* @return array The tokens
*/
public function getTokens()
{
return $this->tokens;
}

/**
* Returns the variables.
*
* @return array The variables
*/
public function getVariables()
{
return $this->variables;
}

/**
* Returns the pattern.
*
* @return string The pattern
*/
public function getPattern()
{
return $this->route->getPattern();
}

/**
* Returns the options.
*
* @return array The options
*/
public function getOptions()
{
return $this->route->getOptions();
}

/**
* Returns the defaults.
*
* @return array The defaults
*/
public function getDefaults()
{
return $this->route->getDefaults();
}

/**
* Returns the requirements.
*
* @return array The requirements
*/
public function getRequirements()
{
return $this->route->getRequirements();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Routing\Exception;

/**
* ExceptionInterface
*
* @author Alexandre Salomé <[email protected]>
*
* @api
*/
interface ExceptionInterface
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Routing\Exception;

/**
* Exception thrown when a parameter is not valid
*
* @author Alexandre Salomé <[email protected]>
*
* @api
*/
class InvalidParameterException extends \InvalidArgumentException implements ExceptionInterface
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Routing\Exception;

/**
* The resource was found but the request method is not allowed.
*
* This exception should trigger an HTTP 405 response in your application code.
*
* @author Kris Wallsmith <[email protected]>
*
* @api
*/
class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface
{
protected $allowedMethods;

public function __construct(array $allowedMethods, $message = null, $code = 0, \Exception $previous = null)
{
$this->allowedMethods = array_map('strtoupper', $allowedMethods);

parent::__construct($message, $code, $previous);
}

public function getAllowedMethods()
{
return $this->allowedMethods;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Routing\Exception;

/**
* Exception thrown when a route cannot be generated because of missing
* mandatory parameters.
*
* @author Alexandre Salomé <[email protected]>
*
* @api
*/
class MissingMandatoryParametersException extends \InvalidArgumentException implements ExceptionInterface
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Routing\Exception;

/**
* The resource was not found.
*
* This exception should trigger an HTTP 404 response in your application code.
*
* @author Kris Wallsmith <[email protected]>
*
* @api
*/
class ResourceNotFoundException extends \RuntimeException implements ExceptionInterface
{
}
Loading

0 comments on commit c1c7653

Please sign in to comment.