From 937441d31b350fb7c18b39b65d8d2d3b8c825a7d Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 21 Nov 2011 22:22:41 -0600 Subject: [PATCH] cleaning up more code. --- laravel/database/connection.php | 8 ++++++++ laravel/database/manager.php | 4 ++++ laravel/routing/filter.php | 4 ++++ laravel/routing/route.php | 3 +++ 4 files changed, 19 insertions(+) diff --git a/laravel/database/connection.php b/laravel/database/connection.php index e0022e3b..9598398b 100644 --- a/laravel/database/connection.php +++ b/laravel/database/connection.php @@ -57,12 +57,20 @@ public function table($table) /** * Create a new query grammar for the connection. * + * Query grammars allow support for new database systems to be added quickly + * and easily. Since the responsibility of the query generation is delegated + * to the grammar classes, it is simple to override only the methods with + * SQL syntax that differs from the default implementation. + * * @return Grammars\Grammar */ protected function grammar() { if (isset($this->grammar)) return $this->grammar; + // We allow the developer to hard-code a grammar for the connection. This really + // has no use yet; however, if database systems that can use multiple grammars + // like ODBC are added in the future, this will be needed. switch (isset($this->config['grammar']) ? $this->config['grammar'] : $this->driver()) { case 'mysql': diff --git a/laravel/database/manager.php b/laravel/database/manager.php index fa92e0ca..5582fb15 100644 --- a/laravel/database/manager.php +++ b/laravel/database/manager.php @@ -71,6 +71,10 @@ protected static function connect($config) /** * Create a new database connector instance. * + * The database connectors are responsible for simply establishing a PDO + * database connection given a configuration. This allows us to easily + * drop in support for new database systems by writing a connector. + * * @param string $driver * @return Connector */ diff --git a/laravel/routing/filter.php b/laravel/routing/filter.php index f0c788b2..3be1072c 100644 --- a/laravel/routing/filter.php +++ b/laravel/routing/filter.php @@ -122,6 +122,10 @@ public function __construct($name, $filters) /** * Determine if this collection's filters apply to a given method. * + * Methods may be included / excluded using the "only" and "except" methods on the + * filter collection. Also, the "on" method may be used to set certain filters to + * only run when the request uses a given HTTP verb. + * * @param string $method * @return bool */ diff --git a/laravel/routing/route.php b/laravel/routing/route.php index b8fd702f..8d4e0286 100644 --- a/laravel/routing/route.php +++ b/laravel/routing/route.php @@ -140,6 +140,9 @@ public function call() */ protected function response() { + // If the route callback is an instance of a Closure, we can call the + // route function directly. There are no before or after filters to + // parse out of the route. if ($this->callback instanceof Closure) { return call_user_func_array($this->callback, $this->parameters);