airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndo...@apache.org
Subject [07/57] [partial] airavata-php-gateway git commit: AIRAVATA 1632 + Job Description for Admin Dashboard
Date Fri, 01 May 2015 21:32:54 GMT
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/ControllerInspector.php
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ControllerInspector.php b/vendor/laravel/framework/src/Illuminate/Routing/ControllerInspector.php
new file mode 100644
index 0000000..d10d476
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/ControllerInspector.php
@@ -0,0 +1,131 @@
+<?php namespace Illuminate\Routing;
+
+use ReflectionClass, ReflectionMethod;
+
+class ControllerInspector {
+
+	/**
+	 * An array of HTTP verbs.
+	 *
+	 * @var array
+	 */
+	protected $verbs = array(
+		'any', 'get', 'post', 'put', 'patch',
+		'delete', 'head', 'options'
+	);
+
+	/**
+	 * Get the routable methods for a controller.
+	 *
+	 * @param  string  $controller
+	 * @param  string  $prefix
+	 * @return array
+	 */
+	public function getRoutable($controller, $prefix)
+	{
+		$routable = array();
+
+		$reflection = new ReflectionClass($controller);
+
+		$methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
+
+		// To get the routable methods, we will simply spin through all methods on the
+		// controller instance checking to see if it belongs to the given class and
+		// is a publicly routable method. If so, we will add it to this listings.
+		foreach ($methods as $method)
+		{
+			if ($this->isRoutable($method))
+			{
+				$data = $this->getMethodData($method, $prefix);
+
+				$routable[$method->name][] = $data;
+
+				// If the routable method is an index method, we will create a special index
+				// route which is simply the prefix and the verb and does not contain any
+				// the wildcard place-holders that each "typical" routes would contain.
+				if ($data['plain'] == $prefix.'/index')
+				{
+					$routable[$method->name][] = $this->getIndexData($data, $prefix);
+				}
+			}
+		}
+
+		return $routable;
+	}
+
+	/**
+	 * Determine if the given controller method is routable.
+	 *
+	 * @param  \ReflectionMethod  $method
+	 * @return bool
+	 */
+	public function isRoutable(ReflectionMethod $method)
+	{
+		if ($method->class == 'Illuminate\Routing\Controller') return false;
+
+		return starts_with($method->name, $this->verbs);
+	}
+
+	/**
+	 * Get the method data for a given method.
+	 *
+	 * @param  \ReflectionMethod  $method
+	 * @param  string  $prefix
+	 * @return array
+	 */
+	public function getMethodData(ReflectionMethod $method, $prefix)
+	{
+		$verb = $this->getVerb($name = $method->name);
+
+		$uri = $this->addUriWildcards($plain = $this->getPlainUri($name, $prefix));
+
+		return compact('verb', 'plain', 'uri');
+	}
+
+	/**
+	 * Get the routable data for an index method.
+	 *
+	 * @param  array   $data
+	 * @param  string  $prefix
+	 * @return array
+	 */
+	protected function getIndexData($data, $prefix)
+	{
+		return array('verb' => $data['verb'], 'plain' => $prefix, 'uri' => $prefix);
+	}
+
+	/**
+	 * Extract the verb from a controller action.
+	 *
+	 * @param  string  $name
+	 * @return string
+	 */
+	public function getVerb($name)
+	{
+		return head(explode('_', snake_case($name)));
+	}
+
+	/**
+	 * Determine the URI from the given method name.
+	 *
+	 * @param  string  $name
+	 * @param  string  $prefix
+	 * @return string
+	 */
+	public function getPlainUri($name, $prefix)
+	{
+		return $prefix.'/'.implode('-', array_slice(explode('_', snake_case($name)), 1));
+	}
+
+	/**
+	 * Add wildcards to the given URI.
+	 *
+	 * @param  string  $uri
+	 * @return string
+	 */
+	public function addUriWildcards($uri)
+	{
+		return $uri.'/{one?}/{two?}/{three?}/{four?}/{five?}';
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/ControllerServiceProvider.php
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ControllerServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Routing/ControllerServiceProvider.php
new file mode 100644
index 0000000..764808b
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/ControllerServiceProvider.php
@@ -0,0 +1,60 @@
+<?php namespace Illuminate\Routing;
+
+use Illuminate\Support\ServiceProvider;
+use Illuminate\Routing\Console\MakeControllerCommand;
+use Illuminate\Routing\Generators\ControllerGenerator;
+
+class ControllerServiceProvider extends ServiceProvider {
+
+	/**
+	 * Indicates if loading of the provider is deferred.
+	 *
+	 * @var bool
+	 */
+	protected $defer = true;
+
+	/**
+	 * Register the service provider.
+	 *
+	 * @return void
+	 */
+	public function register()
+	{
+		$this->registerGenerator();
+
+		$this->commands('command.controller.make');
+	}
+
+	/**
+	 * Register the controller generator command.
+	 *
+	 * @return void
+	 */
+	protected function registerGenerator()
+	{
+		$this->app->bindShared('command.controller.make', function($app)
+		{
+			// The controller generator is responsible for building resourceful controllers
+			// quickly and easily for the developers via the Artisan CLI. We'll go ahead
+			// and register this command instances in this container for registration.
+			$path = $app['path'].'/controllers';
+
+			$generator = new ControllerGenerator($app['files']);
+
+			return new MakeControllerCommand($generator, $path);
+		});
+	}
+
+	/**
+	 * Get the services provided by the provider.
+	 *
+	 * @return array
+	 */
+	public function provides()
+	{
+		return array(
+			'command.controller.make'
+		);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Generators/ControllerGenerator.php
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Generators/ControllerGenerator.php b/vendor/laravel/framework/src/Illuminate/Routing/Generators/ControllerGenerator.php
new file mode 100755
index 0000000..e7c8396
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Generators/ControllerGenerator.php
@@ -0,0 +1,207 @@
+<?php namespace Illuminate\Routing\Generators;
+
+use Illuminate\Filesystem\Filesystem;
+
+class ControllerGenerator {
+
+	/**
+	 * The filesystem instance.
+	 *
+	 * @var \Illuminate\Filesystem\Filesystem
+	 */
+	protected $files;
+
+	/**
+	 * The default resource controller methods.
+	 *
+	 * @var array
+	 */
+	protected $defaults = array(
+		'index',
+		'create',
+		'store',
+		'show',
+		'edit',
+		'update',
+		'destroy'
+	);
+
+	/**
+	 * Create a new controller generator instance.
+	 *
+	 * @param  \Illuminate\Filesystem\Filesystem  $files
+	 * @return void
+	 */
+	public function __construct(Filesystem $files)
+	{
+		$this->files = $files;
+	}
+
+	/**
+	 * Create a new resourceful controller file.
+	 *
+	 * @param  string  $controller
+	 * @param  string  $path
+	 * @param  array   $options
+	 * @return void
+	 */
+	public function make($controller, $path, array $options = array())
+	{
+		$stub = $this->addMethods($this->getController($controller), $options);
+
+		$this->writeFile($stub, $controller, $path);
+
+		return false;
+	}
+
+	/**
+	 * Write the completed stub to disk.
+	 *
+	 * @param  string  $stub
+	 * @param  string  $controller
+	 * @param  string  $path
+	 * @return void
+	 */
+	protected function writeFile($stub, $controller, $path)
+	{
+		if (str_contains($controller, '\\'))
+		{
+			$this->makeDirectory($controller, $path);
+		}
+
+		$controller = str_replace('\\', DIRECTORY_SEPARATOR, $controller);
+
+		if ( ! $this->files->exists($fullPath = $path."/{$controller}.php"))
+		{
+			return $this->files->put($fullPath, $stub);
+		}
+	}
+
+	/**
+	 * Create the directory for the controller.
+	 *
+	 * @param  string  $controller
+	 * @param  string  $path
+	 * @return void
+	 */
+	protected function makeDirectory($controller, $path)
+	{
+		$directory = $this->getDirectory($controller);
+
+		if ( ! $this->files->isDirectory($full = $path.'/'.$directory))
+		{
+			$this->files->makeDirectory($full, 0777, true);
+		}
+	}
+
+	/**
+	 * Get the directory the controller should live in.
+	 *
+	 * @param  string  $controller
+	 * @return string
+	 */
+	protected function getDirectory($controller)
+	{
+		return implode('/', array_slice(explode('\\', $controller), 0, -1));
+	}
+
+	/**
+	 * Get the controller class stub.
+	 *
+	 * @param  string  $controller
+	 * @return string
+	 */
+	protected function getController($controller)
+	{
+		$stub = $this->files->get(__DIR__.'/stubs/controller.stub');
+
+		// We will explode out the controller name on the namespace delimiter so we
+		// are able to replace a namespace in this stub file. If no namespace is
+		// provided we'll just clear out the namespace place-holder locations.
+		$segments = explode('\\', $controller);
+
+		$stub = $this->replaceNamespace($segments, $stub);
+
+		return str_replace('{{class}}', last($segments), $stub);
+	}
+
+	/**
+	 * Replace the namespace on the controller.
+	 *
+	 * @param  array   $segments
+	 * @param  string  $stub
+	 * @return string
+	 */
+	protected function replaceNamespace(array $segments, $stub)
+	{
+		if (count($segments) > 1)
+		{
+			$namespace = implode('\\', array_slice($segments, 0, -1));
+
+			return str_replace('{{namespace}}', ' namespace '.$namespace.';', $stub);
+		}
+
+		return str_replace('{{namespace}}', '', $stub);
+	}
+
+	/**
+	 * Add the method stubs to the controller.
+	 *
+	 * @param  string  $stub
+	 * @param  array   $options
+	 * @return string
+	 */
+	protected function addMethods($stub, array $options)
+	{
+		// Once we have the applicable methods, we can just spin through those methods
+		// and add each one to our array of method stubs. Then we will implode them
+		// them all with end-of-line characters and return the final joined list.
+		$stubs = $this->getMethodStubs($options);
+
+		$methods = implode(PHP_EOL.PHP_EOL, $stubs);
+
+		return str_replace('{{methods}}', $methods, $stub);
+	}
+
+	/**
+	 * Get all of the method stubs for the given options.
+	 *
+	 * @param  array  $options
+	 * @return array
+	 */
+	protected function getMethodStubs($options)
+	{
+		$stubs = array();
+
+		// Each stub is conveniently kept in its own file so we can just grab the ones
+		// we need from disk to build the controller file. Once we have them all in
+		// an array we will return this list of methods so they can be joined up.
+		foreach ($this->getMethods($options) as $method)
+		{
+			$stubs[] = $this->files->get(__DIR__."/stubs/{$method}.stub");
+		}
+
+		return $stubs;
+	}
+
+	/**
+	 * Get the applicable methods based on the options.
+	 *
+	 * @param  array  $options
+	 * @return array
+	 */
+	protected function getMethods($options)
+	{
+		if (isset($options['only']) && count($options['only']) > 0)
+		{
+			return $options['only'];
+		}
+		elseif (isset($options['except']) && count($options['except']) > 0)
+		{
+			return array_diff($this->defaults, $options['except']);
+		}
+
+		return $this->defaults;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/controller.stub
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/controller.stub b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/controller.stub
new file mode 100755
index 0000000..b6d02dd
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/controller.stub
@@ -0,0 +1,7 @@
+<?php{{namespace}}
+
+class {{class}} extends \BaseController {
+
+{{methods}}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/create.stub
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/create.stub b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/create.stub
new file mode 100755
index 0000000..aa59afd
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/create.stub
@@ -0,0 +1,9 @@
+	/**
+	 * Show the form for creating a new resource.
+	 *
+	 * @return Response
+	 */
+	public function create()
+	{
+		//
+	}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/destroy.stub
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/destroy.stub b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/destroy.stub
new file mode 100755
index 0000000..24abe54
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/destroy.stub
@@ -0,0 +1,10 @@
+	/**
+	 * Remove the specified resource from storage.
+	 *
+	 * @param  int  $id
+	 * @return Response
+	 */
+	public function destroy($id)
+	{
+		//
+	}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/edit.stub
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/edit.stub b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/edit.stub
new file mode 100755
index 0000000..ed60754
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/edit.stub
@@ -0,0 +1,10 @@
+	/**
+	 * Show the form for editing the specified resource.
+	 *
+	 * @param  int  $id
+	 * @return Response
+	 */
+	public function edit($id)
+	{
+		//
+	}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/index.stub
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/index.stub b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/index.stub
new file mode 100755
index 0000000..8238ea1
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/index.stub
@@ -0,0 +1,9 @@
+	/**
+	 * Display a listing of the resource.
+	 *
+	 * @return Response
+	 */
+	public function index()
+	{
+		//
+	}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/show.stub
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/show.stub b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/show.stub
new file mode 100755
index 0000000..f2001e4
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/show.stub
@@ -0,0 +1,10 @@
+	/**
+	 * Display the specified resource.
+	 *
+	 * @param  int  $id
+	 * @return Response
+	 */
+	public function show($id)
+	{
+		//
+	}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/store.stub
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/store.stub b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/store.stub
new file mode 100755
index 0000000..a4d28d6
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/store.stub
@@ -0,0 +1,9 @@
+	/**
+	 * Store a newly created resource in storage.
+	 *
+	 * @return Response
+	 */
+	public function store()
+	{
+		//
+	}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/update.stub
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/update.stub b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/update.stub
new file mode 100755
index 0000000..e8e6c06
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Generators/stubs/update.stub
@@ -0,0 +1,10 @@
+	/**
+	 * Update the specified resource in storage.
+	 *
+	 * @param  int  $id
+	 * @return Response
+	 */
+	public function update($id)
+	{
+		//
+	}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php
new file mode 100644
index 0000000..be14f00
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php
@@ -0,0 +1,22 @@
+<?php namespace Illuminate\Routing\Matching;
+
+use Illuminate\Http\Request;
+use Illuminate\Routing\Route;
+
+class HostValidator implements ValidatorInterface {
+
+	/**
+	 * Validate a given rule against a route and request.
+	 *
+	 * @param  \Illuminate\Routing\Route  $route
+	 * @param  \Illuminate\Http\Request  $request
+	 * @return bool
+	 */
+	public function matches(Route $route, Request $request)
+	{
+		if (is_null($route->getCompiled()->getHostRegex())) return true;
+
+		return preg_match($route->getCompiled()->getHostRegex(), $request->getHost());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php
new file mode 100644
index 0000000..211bc30
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php
@@ -0,0 +1,20 @@
+<?php namespace Illuminate\Routing\Matching;
+
+use Illuminate\Http\Request;
+use Illuminate\Routing\Route;
+
+class MethodValidator implements ValidatorInterface {
+
+	/**
+	 * Validate a given rule against a route and request.
+	 *
+	 * @param  \Illuminate\Routing\Route  $route
+	 * @param  \Illuminate\Http\Request  $request
+	 * @return bool
+	 */
+	public function matches(Route $route, Request $request)
+	{
+		return in_array($request->getMethod(), $route->methods());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php
new file mode 100644
index 0000000..009bb94
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php
@@ -0,0 +1,29 @@
+<?php namespace Illuminate\Routing\Matching;
+
+use Illuminate\Http\Request;
+use Illuminate\Routing\Route;
+
+class SchemeValidator implements ValidatorInterface {
+
+	/**
+	 * Validate a given rule against a route and request.
+	 *
+	 * @param  \Illuminate\Routing\Route  $route
+	 * @param  \Illuminate\Http\Request  $request
+	 * @return bool
+	 */
+	public function matches(Route $route, Request $request)
+	{
+		if ($route->httpOnly())
+		{
+			return ! $request->secure();
+		}
+		elseif ($route->secure())
+		{
+			return $request->secure();
+		}
+
+		return true;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php
new file mode 100644
index 0000000..b0b4302
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php
@@ -0,0 +1,22 @@
+<?php namespace Illuminate\Routing\Matching;
+
+use Illuminate\Http\Request;
+use Illuminate\Routing\Route;
+
+class UriValidator implements ValidatorInterface {
+
+	/**
+	 * Validate a given rule against a route and request.
+	 *
+	 * @param  \Illuminate\Routing\Route  $route
+	 * @param  \Illuminate\Http\Request  $request
+	 * @return bool
+	 */
+	public function matches(Route $route, Request $request)
+	{
+		$path = $request->path() == '/' ? '/' : '/'.$request->path();
+
+		return preg_match($route->getCompiled()->getRegex(), rawurldecode($path));
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php
new file mode 100644
index 0000000..65e5638
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php
@@ -0,0 +1,17 @@
+<?php namespace Illuminate\Routing\Matching;
+
+use Illuminate\Http\Request;
+use Illuminate\Routing\Route;
+
+interface ValidatorInterface {
+
+	/**
+	 * Validate a given rule against a route and request.
+	 *
+	 * @param  \Illuminate\Routing\Route  $route
+	 * @param  \Illuminate\Http\Request  $request
+	 * @return bool
+	 */
+	public function matches(Route $route, Request $request);
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Redirector.php
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Redirector.php b/vendor/laravel/framework/src/Illuminate/Routing/Redirector.php
new file mode 100755
index 0000000..2c4b7a8
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Redirector.php
@@ -0,0 +1,219 @@
+<?php namespace Illuminate\Routing;
+
+use Illuminate\Http\RedirectResponse;
+use Illuminate\Session\Store as SessionStore;
+
+class Redirector {
+
+	/**
+	 * The URL generator instance.
+	 *
+	 * @var \Illuminate\Routing\UrlGenerator
+	 */
+	protected $generator;
+
+	/**
+	 * The session store instance.
+	 *
+	 * @var \Illuminate\Session\Store
+	 */
+	protected $session;
+
+	/**
+	 * Create a new Redirector instance.
+	 *
+	 * @param  \Illuminate\Routing\UrlGenerator  $generator
+	 * @return void
+	 */
+	public function __construct(UrlGenerator $generator)
+	{
+		$this->generator = $generator;
+	}
+
+	/**
+	 * Create a new redirect response to the "home" route.
+	 *
+	 * @param  int  $status
+	 * @return \Illuminate\Http\RedirectResponse
+	 */
+	public function home($status = 302)
+	{
+		return $this->to($this->generator->route('home'), $status);
+	}
+
+	/**
+	 * Create a new redirect response to the previous location.
+	 *
+	 * @param  int    $status
+	 * @param  array  $headers
+	 * @return \Illuminate\Http\RedirectResponse
+	 */
+	public function back($status = 302, $headers = array())
+	{
+		$back = $this->generator->getRequest()->headers->get('referer');
+
+		return $this->createRedirect($back, $status, $headers);
+	}
+
+	/**
+	 * Create a new redirect response to the current URI.
+	 *
+	 * @param  int    $status
+	 * @param  array  $headers
+	 * @return \Illuminate\Http\RedirectResponse
+	 */
+	public function refresh($status = 302, $headers = array())
+	{
+		return $this->to($this->generator->getRequest()->path(), $status, $headers);
+	}
+
+	/**
+	 * Create a new redirect response, while putting the current URL in the session.
+	 *
+	 * @param  string  $path
+	 * @param  int     $status
+	 * @param  array   $headers
+	 * @param  bool    $secure
+	 * @return \Illuminate\Http\RedirectResponse
+	 */
+	public function guest($path, $status = 302, $headers = array(), $secure = null)
+	{
+		$this->session->put('url.intended', $this->generator->full());
+
+		return $this->to($path, $status, $headers, $secure);
+	}
+
+	/**
+	 * Create a new redirect response to the previously intended location.
+	 *
+	 * @param  string  $default
+	 * @param  int     $status
+	 * @param  array   $headers
+	 * @param  bool    $secure
+	 * @return \Illuminate\Http\RedirectResponse
+	 */
+	public function intended($default = '/', $status = 302, $headers = array(), $secure = null)
+	{
+		$path = $this->session->pull('url.intended', $default);
+
+		return $this->to($path, $status, $headers, $secure);
+	}
+
+	/**
+	 * Create a new redirect response to the given path.
+	 *
+	 * @param  string  $path
+	 * @param  int     $status
+	 * @param  array   $headers
+	 * @param  bool    $secure
+	 * @return \Illuminate\Http\RedirectResponse
+	 */
+	public function to($path, $status = 302, $headers = array(), $secure = null)
+	{
+		$path = $this->generator->to($path, array(), $secure);
+
+		return $this->createRedirect($path, $status, $headers);
+	}
+
+	/**
+	 * Create a new redirect response to an external URL (no validation).
+	 *
+	 * @param  string  $path
+	 * @param  int     $status
+	 * @param  array   $headers
+	 * @return \Illuminate\Http\RedirectResponse
+	 */
+	public function away($path, $status = 302, $headers = array())
+	{
+		return $this->createRedirect($path, $status, $headers);
+	}
+
+	/**
+	 * Create a new redirect response to the given HTTPS path.
+	 *
+	 * @param  string  $path
+	 * @param  int     $status
+	 * @param  array   $headers
+	 * @return \Illuminate\Http\RedirectResponse
+	 */
+	public function secure($path, $status = 302, $headers = array())
+	{
+		return $this->to($path, $status, $headers, true);
+	}
+
+	/**
+	 * Create a new redirect response to a named route.
+	 *
+	 * @param  string  $route
+	 * @param  array   $parameters
+	 * @param  int     $status
+	 * @param  array   $headers
+	 * @return \Illuminate\Http\RedirectResponse
+	 */
+	public function route($route, $parameters = array(), $status = 302, $headers = array())
+	{
+		$path = $this->generator->route($route, $parameters);
+
+		return $this->to($path, $status, $headers);
+	}
+
+	/**
+	 * Create a new redirect response to a controller action.
+	 *
+	 * @param  string  $action
+	 * @param  array   $parameters
+	 * @param  int     $status
+	 * @param  array   $headers
+	 * @return \Illuminate\Http\RedirectResponse
+	 */
+	public function action($action, $parameters = array(), $status = 302, $headers = array())
+	{
+		$path = $this->generator->action($action, $parameters);
+
+		return $this->to($path, $status, $headers);
+	}
+
+	/**
+	 * Create a new redirect response.
+	 *
+	 * @param  string  $path
+	 * @param  int     $status
+	 * @param  array   $headers
+	 * @return \Illuminate\Http\RedirectResponse
+	 */
+	protected function createRedirect($path, $status, $headers)
+	{
+		$redirect = new RedirectResponse($path, $status, $headers);
+
+		if (isset($this->session))
+		{
+			$redirect->setSession($this->session);
+		}
+
+		$redirect->setRequest($this->generator->getRequest());
+
+		return $redirect;
+	}
+
+	/**
+	 * Get the URL generator instance.
+	 *
+	 * @return  \Illuminate\Routing\UrlGenerator
+	 */
+	public function getUrlGenerator()
+	{
+		return $this->generator;
+	}
+
+	/**
+	 * Set the active session store.
+	 *
+	 * @param  \Illuminate\Session\Store  $session
+	 * @return void
+	 */
+	public function setSession(SessionStore $session)
+	{
+		$this->session = $session;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/Route.php
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Route.php b/vendor/laravel/framework/src/Illuminate/Routing/Route.php
new file mode 100755
index 0000000..093014f
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/Route.php
@@ -0,0 +1,814 @@
+<?php namespace Illuminate\Routing;
+
+use Illuminate\Http\Request;
+use Illuminate\Routing\Matching\UriValidator;
+use Illuminate\Routing\Matching\HostValidator;
+use Illuminate\Routing\Matching\MethodValidator;
+use Illuminate\Routing\Matching\SchemeValidator;
+use Symfony\Component\Routing\Route as SymfonyRoute;
+
+class Route {
+
+	/**
+	 * The URI pattern the route responds to.
+	 *
+	 * @var string
+	 */
+	protected $uri;
+
+	/**
+	 * The HTTP methods the route responds to.
+	 *
+	 * @var array
+	 */
+	protected $methods;
+
+	/**
+	 * The route action array.
+	 *
+	 * @var array
+	 */
+	protected $action;
+
+	/**
+	 * The default values for the route.
+	 *
+	 * @var array
+	 */
+	protected $defaults = array();
+
+	/**
+	 * The regular expression requirements.
+	 *
+	 * @var array
+	 */
+	protected $wheres = array();
+
+	/**
+	 * The array of matched parameters.
+	 *
+	 * @var array
+	 */
+	protected $parameters;
+
+	/**
+	 * The parameter names for the route.
+	 *
+	 * @var array|null
+	 */
+	protected $parameterNames;
+
+	/**
+	 * The compiled version of the route.
+	 *
+	 * @var \Symfony\Component\Routing\CompiledRoute
+	 */
+	protected $compiled;
+
+	/**
+	 * The validators used by the routes.
+	 *
+	 * @var array
+	 */
+	protected static $validators;
+
+	/**
+	 * Create a new Route instance.
+	 *
+	 * @param  array   $methods
+	 * @param  string  $uri
+	 * @param  \Closure|array  $action
+	 * @return void
+	 */
+	public function __construct($methods, $uri, $action)
+	{
+		$this->uri = $uri;
+		$this->methods = (array) $methods;
+		$this->action = $this->parseAction($action);
+
+		if (in_array('GET', $this->methods) && ! in_array('HEAD', $this->methods))
+		{
+			$this->methods[] = 'HEAD';
+		}
+
+		if (isset($this->action['prefix']))
+		{
+			$this->prefix($this->action['prefix']);
+		}
+	}
+
+	/**
+	 * Run the route action and return the response.
+	 *
+	 * @return mixed
+	 */
+	public function run()
+	{
+		$parameters = array_filter($this->parameters(), function($p) { return isset($p); });
+
+		return call_user_func_array($this->action['uses'], $parameters);
+	}
+
+	/**
+	 * Determine if the route matches given request.
+	 *
+	 * @param  \Illuminate\Http\Request  $request
+	 * @param  bool  $includingMethod
+	 * @return bool
+	 */
+	public function matches(Request $request, $includingMethod = true)
+	{
+		$this->compileRoute();
+
+		foreach ($this->getValidators() as $validator)
+		{
+			if ( ! $includingMethod && $validator instanceof MethodValidator) continue;
+
+			if ( ! $validator->matches($this, $request)) return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Compile the route into a Symfony CompiledRoute instance.
+	 *
+	 * @return void
+	 */
+	protected function compileRoute()
+	{
+		$optionals = $this->extractOptionalParameters();
+
+		$uri = preg_replace('/\{(\w+?)\?\}/', '{$1}', $this->uri);
+
+		$this->compiled = with(
+
+			new SymfonyRoute($uri, $optionals, $this->wheres, array(), $this->domain() ?: '')
+
+		)->compile();
+	}
+
+	/**
+	 * Get the optional parameters for the route.
+	 *
+	 * @return array
+	 */
+	protected function extractOptionalParameters()
+	{
+		preg_match_all('/\{(\w+?)\?\}/', $this->uri, $matches);
+
+		return isset($matches[1]) ? array_fill_keys($matches[1], null) : [];
+	}
+
+	/**
+	 * Get the "before" filters for the route.
+	 *
+	 * @return array
+	 */
+	public function beforeFilters()
+	{
+		if ( ! isset($this->action['before'])) return array();
+
+		return $this->parseFilters($this->action['before']);
+	}
+
+	/**
+	 * Get the "after" filters for the route.
+	 *
+	 * @return array
+	 */
+	public function afterFilters()
+	{
+		if ( ! isset($this->action['after'])) return array();
+
+		return $this->parseFilters($this->action['after']);
+	}
+
+	/**
+	 * Parse the given filter string.
+	 *
+	 * @param  string  $filters
+	 * @return array
+	 */
+	public static function parseFilters($filters)
+	{
+		return array_build(static::explodeFilters($filters), function($key, $value)
+		{
+			return Route::parseFilter($value);
+		});
+	}
+
+	/**
+	 * Turn the filters into an array if they aren't already.
+	 *
+	 * @param  array|string  $filters
+	 * @return array
+	 */
+	protected static function explodeFilters($filters)
+	{
+		if (is_array($filters)) return static::explodeArrayFilters($filters);
+
+		return array_map('trim', explode('|', $filters));
+	}
+
+	/**
+	 * Flatten out an array of filter declarations.
+	 *
+	 * @param  array  $filters
+	 * @return array
+	 */
+	protected static function explodeArrayFilters(array $filters)
+	{
+		$results = array();
+
+		foreach ($filters as $filter)
+		{
+			$results = array_merge($results, array_map('trim', explode('|', $filter)));
+		}
+
+		return $results;
+	}
+
+	/**
+	 * Parse the given filter into name and parameters.
+	 *
+	 * @param  string  $filter
+	 * @return array
+	 */
+	public static function parseFilter($filter)
+	{
+		if ( ! str_contains($filter, ':')) return array($filter, array());
+
+		return static::parseParameterFilter($filter);
+	}
+
+	/**
+	 * Parse a filter with parameters.
+	 *
+	 * @param  string  $filter
+	 * @return array
+	 */
+	protected static function parseParameterFilter($filter)
+	{
+		list($name, $parameters) = explode(':', $filter, 2);
+
+		return array($name, explode(',', $parameters));
+	}
+
+	/**
+	 * Get a given parameter from the route.
+	 *
+	 * @param  string  $name
+	 * @param  mixed   $default
+	 * @return string
+	 */
+	public function getParameter($name, $default = null)
+	{
+		return $this->parameter($name, $default);
+	}
+
+	/**
+	 * Get a given parameter from the route.
+	 *
+	 * @param  string  $name
+	 * @param  mixed   $default
+	 * @return string
+	 */
+	public function parameter($name, $default = null)
+	{
+		return array_get($this->parameters(), $name, $default);
+	}
+
+	/**
+	 * Set a parameter to the given value.
+	 *
+	 * @param  string  $name
+	 * @param  mixed   $value
+	 * @return void
+	 */
+	public function setParameter($name, $value)
+	{
+		$this->parameters();
+
+		$this->parameters[$name] = $value;
+	}
+
+	/**
+	 * Unset a parameter on the route if it is set.
+	 *
+	 * @param  string  $name
+	 * @return void
+	 */
+	public function forgetParameter($name)
+	{
+		$this->parameters();
+
+		unset($this->parameters[$name]);
+	}
+
+	/**
+	 * Get the key / value list of parameters for the route.
+	 *
+	 * @return array
+	 *
+	 * @throws \LogicException
+	 */
+	public function parameters()
+	{
+		if (isset($this->parameters))
+		{
+			return array_map(function($value)
+			{
+				return is_string($value) ? rawurldecode($value) : $value;
+
+			}, $this->parameters);
+		}
+
+		throw new \LogicException("Route is not bound.");
+	}
+
+	/**
+	 * Get the key / value list of parameters without null values.
+	 *
+	 * @return array
+	 */
+	public function parametersWithoutNulls()
+	{
+		return array_filter($this->parameters(), function($p) { return ! is_null($p); });
+	}
+
+	/**
+	 * Get all of the parameter names for the route.
+	 *
+	 * @return array
+	 */
+	public function parameterNames()
+	{
+		if (isset($this->parameterNames)) return $this->parameterNames;
+
+		return $this->parameterNames = $this->compileParameterNames();
+	}
+
+	/**
+	 * Get the parameter names for the route.
+	 *
+	 * @return array
+	 */
+	protected function compileParameterNames()
+	{
+		preg_match_all('/\{(.*?)\}/', $this->domain().$this->uri, $matches);
+
+		return array_map(function($m) { return trim($m, '?'); }, $matches[1]);
+	}
+
+	/**
+	 * Bind the route to a given request for execution.
+	 *
+	 * @param  \Illuminate\Http\Request  $request
+	 * @return $this
+	 */
+	public function bind(Request $request)
+	{
+		$this->compileRoute();
+
+		$this->bindParameters($request);
+
+		return $this;
+	}
+
+	/**
+	 * Extract the parameter list from the request.
+	 *
+	 * @param  \Illuminate\Http\Request  $request
+	 * @return array
+	 */
+	public function bindParameters(Request $request)
+	{
+		// If the route has a regular expression for the host part of the URI, we will
+		// compile that and get the parameter matches for this domain. We will then
+		// merge them into this parameters array so that this array is completed.
+		$params = $this->matchToKeys(
+
+			array_slice($this->bindPathParameters($request), 1)
+
+		);
+
+		// If the route has a regular expression for the host part of the URI, we will
+		// compile that and get the parameter matches for this domain. We will then
+		// merge them into this parameters array so that this array is completed.
+		if ( ! is_null($this->compiled->getHostRegex()))
+		{
+			$params = $this->bindHostParameters(
+				$request, $params
+			);
+		}
+
+		return $this->parameters = $this->replaceDefaults($params);
+	}
+
+	/**
+	 * Get the parameter matches for the path portion of the URI.
+	 *
+	 * @param  \Illuminate\Http\Request  $request
+	 * @return array
+	 */
+	protected function bindPathParameters(Request $request)
+	{
+		preg_match($this->compiled->getRegex(), '/'.$request->decodedPath(), $matches);
+
+		return $matches;
+	}
+
+	/**
+	 * Extract the parameter list from the host part of the request.
+	 *
+	 * @param  \Illuminate\Http\Request  $request
+	 * @param  array  $parameters
+	 * @return array
+	 */
+	protected function bindHostParameters(Request $request, $parameters)
+	{
+		preg_match($this->compiled->getHostRegex(), $request->getHost(), $matches);
+
+		return array_merge($this->matchToKeys(array_slice($matches, 1)), $parameters);
+	}
+
+	/**
+	 * Combine a set of parameter matches with the route's keys.
+	 *
+	 * @param  array  $matches
+	 * @return array
+	 */
+	protected function matchToKeys(array $matches)
+	{
+		if (count($this->parameterNames()) == 0) return array();
+
+		$parameters = array_intersect_key($matches, array_flip($this->parameterNames()));
+
+		return array_filter($parameters, function($value)
+		{
+			return is_string($value) && strlen($value) > 0;
+		});
+	}
+
+	/**
+	 * Replace null parameters with their defaults.
+	 *
+	 * @param  array  $parameters
+	 * @return array
+	 */
+	protected function replaceDefaults(array $parameters)
+	{
+		foreach ($parameters as $key => &$value)
+		{
+			$value = isset($value) ? $value : array_get($this->defaults, $key);
+		}
+
+		return $parameters;
+	}
+
+	/**
+	 * Parse the route action into a standard array.
+	 *
+	 * @param  callable|array  $action
+	 * @return array
+	 */
+	protected function parseAction($action)
+	{
+		// If the action is already a Closure instance, we will just set that instance
+		// as the "uses" property, because there is nothing else we need to do when
+		// it is available. Otherwise we will need to find it in the action list.
+		if (is_callable($action))
+		{
+			return array('uses' => $action);
+		}
+
+		// If no "uses" property has been set, we will dig through the array to find a
+		// Closure instance within this list. We will set the first Closure we come
+		// across into the "uses" property that will get fired off by this route.
+		elseif ( ! isset($action['uses']))
+		{
+			$action['uses'] = $this->findClosure($action);
+		}
+
+		return $action;
+	}
+
+	/**
+	 * Find the Closure in an action array.
+	 *
+	 * @param  array  $action
+	 * @return \Closure
+	 */
+	protected function findClosure(array $action)
+	{
+		return array_first($action, function($key, $value)
+		{
+			return is_callable($value);
+		});
+	}
+
+	/**
+	 * Get the route validators for the instance.
+	 *
+	 * @return array
+	 */
+	public static function getValidators()
+	{
+		if (isset(static::$validators)) return static::$validators;
+
+		// To match the route, we will use a chain of responsibility pattern with the
+		// validator implementations. We will spin through each one making sure it
+		// passes and then we will know if the route as a whole matches request.
+		return static::$validators = array(
+			new MethodValidator, new SchemeValidator,
+			new HostValidator, new UriValidator,
+		);
+	}
+
+	/**
+	 * Add before filters to the route.
+	 *
+	 * @param  string  $filters
+	 * @return $this
+	 */
+	public function before($filters)
+	{
+		return $this->addFilters('before', $filters);
+	}
+
+	/**
+	 * Add after filters to the route.
+	 *
+	 * @param  string  $filters
+	 * @return $this
+	 */
+	public function after($filters)
+	{
+		return $this->addFilters('after', $filters);
+	}
+
+	/**
+	 * Add the given filters to the route by type.
+	 *
+	 * @param  string  $type
+	 * @param  string  $filters
+	 * @return $this
+	 */
+	protected function addFilters($type, $filters)
+	{
+		$filters = static::explodeFilters($filters);
+
+		if (isset($this->action[$type]))
+		{
+			$existing = static::explodeFilters($this->action[$type]);
+
+			$this->action[$type] = array_merge($existing, $filters);
+		}
+		else
+		{
+			$this->action[$type] = $filters;
+		}
+
+		return $this;
+	}
+
+	/**
+	 * Set a default value for the route.
+	 *
+	 * @param  string  $key
+	 * @param  mixed  $value
+	 * @return $this
+	 */
+	public function defaults($key, $value)
+	{
+		$this->defaults[$key] = $value;
+
+		return $this;
+	}
+
+	/**
+	 * Set a regular expression requirement on the route.
+	 *
+	 * @param  array|string  $name
+	 * @param  string  $expression
+	 * @return $this
+	 */
+	public function where($name, $expression = null)
+	{
+		foreach ($this->parseWhere($name, $expression) as $name => $expression)
+		{
+			$this->wheres[$name] = $expression;
+		}
+
+		return $this;
+	}
+
+	/**
+	 * Parse arguments to the where method into an array.
+	 *
+	 * @param  array|string  $name
+	 * @param  string  $expression
+	 * @return array
+	 */
+	protected function parseWhere($name, $expression)
+	{
+		return is_array($name) ? $name : array($name => $expression);
+	}
+
+	/**
+	 * Set a list of regular expression requirements on the route.
+	 *
+	 * @param  array  $wheres
+	 * @return $this
+	 */
+	protected function whereArray(array $wheres)
+	{
+		foreach ($wheres as $name => $expression)
+		{
+			$this->where($name, $expression);
+		}
+
+		return $this;
+	}
+
+	/**
+	 * Add a prefix to the route URI.
+	 *
+	 * @param  string  $prefix
+	 * @return $this
+	 */
+	public function prefix($prefix)
+	{
+		$this->uri = trim($prefix, '/').'/'.trim($this->uri, '/');
+
+		return $this;
+	}
+
+	/**
+	 * Get the URI associated with the route.
+	 *
+	 * @return string
+	 */
+	public function getPath()
+	{
+		return $this->uri();
+	}
+
+	/**
+	 * Get the URI associated with the route.
+	 *
+	 * @return string
+	 */
+	public function uri()
+	{
+		return $this->uri;
+	}
+
+	/**
+	 * Get the HTTP verbs the route responds to.
+	 *
+	 * @return array
+	 */
+	public function getMethods()
+	{
+		return $this->methods();
+	}
+
+	/**
+	 * Get the HTTP verbs the route responds to.
+	 *
+	 * @return array
+	 */
+	public function methods()
+	{
+		return $this->methods;
+	}
+
+	/**
+	 * Determine if the route only responds to HTTP requests.
+	 *
+	 * @return bool
+	 */
+	public function httpOnly()
+	{
+		return in_array('http', $this->action, true);
+	}
+
+	/**
+	 * Determine if the route only responds to HTTPS requests.
+	 *
+	 * @return bool
+	 */
+	public function httpsOnly()
+	{
+		return $this->secure();
+	}
+
+	/**
+	 * Determine if the route only responds to HTTPS requests.
+	 *
+	 * @return bool
+	 */
+	public function secure()
+	{
+		return in_array('https', $this->action, true);
+	}
+
+	/**
+	 * Get the domain defined for the route.
+	 *
+	 * @return string|null
+	 */
+	public function domain()
+	{
+		return isset($this->action['domain']) ? $this->action['domain'] : null;
+	}
+
+	/**
+	 * Get the URI that the route responds to.
+	 *
+	 * @return string
+	 */
+	public function getUri()
+	{
+		return $this->uri;
+	}
+
+	/**
+	 * Set the URI that the route responds to.
+	 *
+	 * @param  string  $uri
+	 * @return \Illuminate\Routing\Route
+	 */
+	public function setUri($uri)
+	{
+		$this->uri = $uri;
+
+		return $this;
+	}
+
+	/**
+	 * Get the prefix of the route instance.
+	 *
+	 * @return string
+	 */
+	public function getPrefix()
+	{
+		return isset($this->action['prefix']) ? $this->action['prefix'] : null;
+	}
+
+	/**
+	 * Get the name of the route instance.
+	 *
+	 * @return string
+	 */
+	public function getName()
+	{
+		return isset($this->action['as']) ? $this->action['as'] : null;
+	}
+
+	/**
+	 * Get the action name for the route.
+	 *
+	 * @return string
+	 */
+	public function getActionName()
+	{
+		return isset($this->action['controller']) ? $this->action['controller'] : 'Closure';
+	}
+
+	/**
+	 * Get the action array for the route.
+	 *
+	 * @return array
+	 */
+	public function getAction()
+	{
+		return $this->action;
+	}
+
+	/**
+	 * Set the action array for the route.
+	 *
+	 * @param  array  $action
+	 * @return $this
+	 */
+	public function setAction(array $action)
+	{
+		$this->action = $action;
+
+		return $this;
+	}
+
+	/**
+	 * Get the compiled version of the route.
+	 *
+	 * @return \Symfony\Component\Routing\CompiledRoute
+	 */
+	public function getCompiled()
+	{
+		return $this->compiled;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php
new file mode 100644
index 0000000..abfea49
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php
@@ -0,0 +1,305 @@
+<?php namespace Illuminate\Routing;
+
+use Countable;
+use ArrayIterator;
+use IteratorAggregate;
+use Illuminate\Http\Request;
+use Illuminate\Http\Response;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
+
+class RouteCollection implements Countable, IteratorAggregate {
+
+	/**
+	 * An array of the routes keyed by method.
+	 *
+	 * @var array
+	 */
+	protected $routes = array();
+
+	/**
+	 * An flattened array of all of the routes.
+	 *
+	 * @var array
+	 */
+	protected $allRoutes = array();
+
+	/**
+	 * A look-up table of routes by their names.
+	 *
+	 * @var array
+	 */
+	protected $nameList = array();
+
+	/**
+	 * A look-up table of routes by controller action.
+	 *
+	 * @var array
+	 */
+	protected $actionList = array();
+
+	/**
+	 * Add a Route instance to the collection.
+	 *
+	 * @param  \Illuminate\Routing\Route  $route
+	 * @return \Illuminate\Routing\Route
+	 */
+	public function add(Route $route)
+	{
+		$this->addToCollections($route);
+
+		$this->addLookups($route);
+
+		return $route;
+	}
+
+	/**
+	 * Add the given route to the arrays of routes.
+	 *
+	 * @param  \Illuminate\Routing\Route  $route
+	 * @return void
+	 */
+	protected function addToCollections($route)
+	{
+		$domainAndUri = $route->domain().$route->getUri();
+
+		foreach ($route->methods() as $method)
+		{
+			$this->routes[$method][$domainAndUri] = $route;
+		}
+
+		$this->allRoutes[$method.$domainAndUri] = $route;
+	}
+
+	/**
+	 * Add the route to any look-up tables if necessary.
+	 *
+	 * @param  \Illuminate\Routing\Route  $route
+	 * @return void
+	 */
+	protected function addLookups($route)
+	{
+		// If the route has a name, we will add it to the name look-up table so that we
+		// will quickly be able to find any route associate with a name and not have
+		// to iterate through every route every time we need to perform a look-up.
+		$action = $route->getAction();
+
+		if (isset($action['as']))
+		{
+			$this->nameList[$action['as']] = $route;
+		}
+
+		// When the route is routing to a controller we will also store the action that
+		// is used by the route. This will let us reverse route to controllers while
+		// processing a request and easily generate URLs to the given controllers.
+		if (isset($action['controller']))
+		{
+			$this->addToActionList($action, $route);
+		}
+	}
+
+	/**
+	 * Add a route to the controller action dictionary.
+	 *
+	 * @param  array  $action
+	 * @param  \Illuminate\Routing\Route  $route
+	 * @return void
+	 */
+	protected function addToActionList($action, $route)
+	{
+		if ( ! isset($this->actionList[$action['controller']]))
+		{
+			$this->actionList[$action['controller']] = $route;
+		}
+	}
+
+	/**
+	 * Find the first route matching a given request.
+	 *
+	 * @param  \Illuminate\Http\Request  $request
+	 * @return \Illuminate\Routing\Route
+	 *
+	 * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
+	 */
+	public function match(Request $request)
+	{
+		$routes = $this->get($request->getMethod());
+
+		// First, we will see if we can find a matching route for this current request
+		// method. If we can, great, we can just return it so that it can be called
+		// by the consumer. Otherwise we will check for routes with another verb.
+		$route = $this->check($routes, $request);
+
+		if ( ! is_null($route))
+		{
+			return $route->bind($request);
+		}
+
+		// If no route was found, we will check if a matching is route is specified on
+		// another HTTP verb. If it is we will need to throw a MethodNotAllowed and
+		// inform the user agent of which HTTP verb it should use for this route.
+		$others = $this->checkForAlternateVerbs($request);
+
+		if (count($others) > 0)
+		{
+			return $this->getOtherMethodsRoute($request, $others);
+		}
+
+		throw new NotFoundHttpException;
+	}
+
+	/**
+	 * Determine if any routes match on another HTTP verb.
+	 *
+	 * @param  \Illuminate\Http\Request  $request
+	 * @return array
+	 */
+	protected function checkForAlternateVerbs($request)
+	{
+		$methods = array_diff(Router::$verbs, array($request->getMethod()));
+
+		// Here we will spin through all verbs except for the current request verb and
+		// check to see if any routes respond to them. If they do, we will return a
+		// proper error response with the correct headers on the response string.
+		$others = array();
+
+		foreach ($methods as $method)
+		{
+			if ( ! is_null($this->check($this->get($method), $request, false)))
+			{
+				$others[] = $method;
+			}
+		}
+
+		return $others;
+	}
+
+	/**
+	 * Get a route (if necessary) that responds when other available methods are present.
+	 *
+	 * @param  \Illuminate\Http\Request  $request
+	 * @param  array  $others
+	 * @return \Illuminate\Routing\Route
+	 *
+	 * @throws \Symfony\Component\Routing\Exception\MethodNotAllowedHttpException
+	 */
+	protected function getOtherMethodsRoute($request, array $others)
+	{
+		if ($request->method() == 'OPTIONS')
+		{
+			return (new Route('OPTIONS', $request->path(), function() use ($others)
+			{
+				return new Response('', 200, array('Allow' => implode(',', $others)));
+
+			}))->bind($request);
+		}
+
+		$this->methodNotAllowed($others);
+	}
+
+	/**
+	 * Throw a method not allowed HTTP exception.
+	 *
+	 * @param  array  $others
+	 * @return void
+	 *
+	 * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
+	 */
+	protected function methodNotAllowed(array $others)
+	{
+		throw new MethodNotAllowedHttpException($others);
+	}
+
+	/**
+	 * Determine if a route in the array matches the request.
+	 *
+	 * @param  array  $routes
+	 * @param  \Illuminate\http\Request  $request
+	 * @param  bool  $includingMethod
+	 * @return \Illuminate\Routing\Route|null
+	 */
+	protected function check(array $routes, $request, $includingMethod = true)
+	{
+		return array_first($routes, function($key, $value) use ($request, $includingMethod)
+		{
+			return $value->matches($request, $includingMethod);
+		});
+	}
+
+	/**
+	 * Get all of the routes in the collection.
+	 *
+	 * @param  string|null  $method
+	 * @return array
+	 */
+	protected function get($method = null)
+	{
+		if (is_null($method)) return $this->getRoutes();
+
+		return array_get($this->routes, $method, array());
+	}
+
+	/**
+	 * Determine if the route collection contains a given named route.
+	 *
+	 * @param  string  $name
+	 * @return bool
+	 */
+	public function hasNamedRoute($name)
+	{
+		return ! is_null($this->getByName($name));
+	}
+
+	/**
+	 * Get a route instance by its name.
+	 *
+	 * @param  string  $name
+	 * @return \Illuminate\Routing\Route|null
+	 */
+	public function getByName($name)
+	{
+		return isset($this->nameList[$name]) ? $this->nameList[$name] : null;
+	}
+
+	/**
+	 * Get a route instance by its controller action.
+	 *
+	 * @param  string  $action
+	 * @return \Illuminate\Routing\Route|null
+	 */
+	public function getByAction($action)
+	{
+		return isset($this->actionList[$action]) ? $this->actionList[$action] : null;
+	}
+
+	/**
+	 * Get all of the routes in the collection.
+	 *
+	 * @return array
+	 */
+	public function getRoutes()
+	{
+		return array_values($this->allRoutes);
+	}
+
+	/**
+	 * Get an iterator for the items.
+	 *
+	 * @return \ArrayIterator
+	 */
+	public function getIterator()
+	{
+		return new ArrayIterator($this->getRoutes());
+	}
+
+	/**
+	 * Count the number of items in the collection.
+	 *
+	 * @return int
+	 */
+	public function count()
+	{
+		return count($this->getRoutes());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/01413d65/vendor/laravel/framework/src/Illuminate/Routing/RouteFiltererInterface.php
----------------------------------------------------------------------
diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteFiltererInterface.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteFiltererInterface.php
new file mode 100644
index 0000000..2cc0d12
--- /dev/null
+++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteFiltererInterface.php
@@ -0,0 +1,26 @@
+<?php namespace Illuminate\Routing;
+
+interface RouteFiltererInterface {
+
+	/**
+	 * Register a new filter with the router.
+	 *
+	 * @param  string  $name
+	 * @param  mixed  $callback
+	 * @return void
+	 */
+	public function filter($name, $callback);
+
+	/**
+	 * Call the given route filter.
+	 *
+	 * @param  string  $filter
+	 * @param  array  $parameters
+	 * @param  \Illuminate\Routing\Route  $route
+	 * @param  \Illuminate\Http\Request  $request
+	 * @param  \Illuminate\Http\Response|null $response
+	 * @return mixed
+	 */
+	public function callRouteFilter($filter, $parameters, $route, $request, $response = null);
+
+}


Mime
View raw message