From e86cd79b11a302928a8b89ee6f4403c3d45835af Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Thu, 2 Aug 2012 18:50:44 +0300 Subject: [PATCH 1/5] Make database connection protected in session driver. --- laravel/session/drivers/database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/session/drivers/database.php b/laravel/session/drivers/database.php index d151ee53..e905bbe6 100644 --- a/laravel/session/drivers/database.php +++ b/laravel/session/drivers/database.php @@ -10,7 +10,7 @@ class Database extends Driver implements Sweeper { * * @var Connection */ - private $connection; + protected $connection; /** * Create a new database session driver. From 690e8572aa40edf6a813984b79fe11e9a9857d09 Mon Sep 17 00:00:00 2001 From: Sergii Grebeniuk Date: Fri, 3 Aug 2012 18:17:48 +0300 Subject: [PATCH 2/5] phpdoc fixes --- laravel/blade.php | 7 ++++--- laravel/cache/drivers/driver.php | 1 + laravel/cache/drivers/memcached.php | 1 + laravel/cache/drivers/sectionable.php | 1 + laravel/cli/tasks/help.php | 1 - laravel/cli/tasks/test/runner.php | 1 + laravel/database/eloquent/model.php | 1 + .../database/eloquent/relationships/belongs_to.php | 5 +++-- laravel/database/eloquent/relationships/has_many.php | 5 +++-- .../relationships/has_many_and_belongs_to.php | 11 +++++++---- laravel/database/eloquent/relationships/has_one.php | 5 +++-- laravel/database/query.php | 1 + laravel/database/schema.php | 2 +- laravel/database/schema/grammars/grammar.php | 4 ++-- laravel/database/schema/grammars/mysql.php | 2 +- laravel/database/schema/grammars/postgres.php | 2 +- laravel/database/schema/grammars/sqlserver.php | 2 +- laravel/database/schema/table.php | 1 + laravel/event.php | 2 +- laravel/form.php | 2 +- laravel/helpers.php | 2 +- laravel/html.php | 2 +- laravel/ioc.php | 1 + laravel/log.php | 3 ++- laravel/pluralizer.php | 1 + laravel/profiling/profiler.php | 2 ++ laravel/redirect.php | 2 +- laravel/request.php | 1 + laravel/routing/router.php | 2 +- laravel/validator.php | 1 + laravel/view.php | 2 +- 31 files changed, 48 insertions(+), 28 deletions(-) diff --git a/laravel/blade.php b/laravel/blade.php index 69d94128..15c8efde 100644 --- a/laravel/blade.php +++ b/laravel/blade.php @@ -95,7 +95,6 @@ public static function extend(Closure $compiler) * * @param string $view * @param string $path - * @param string $compiled * @return bool */ public static function expired($view, $path) @@ -106,7 +105,7 @@ public static function expired($view, $path) /** * Compiles the specified file containing Blade pseudo-code into valid PHP. * - * @param string $path + * @param string $view * @return string */ public static function compile($view) @@ -168,6 +167,7 @@ function($matches) use (&$value) * Extract a variable value out of a Blade expression. * * @param string $value + * @param string $expression * @return string */ protected static function extract($value, $expression) @@ -403,6 +403,7 @@ protected static function compile_yields($value) /** * Rewrites Blade yield section statements into valid PHP. * + * @param string $value * @return string */ protected static function compile_yield_sections($value) @@ -468,7 +469,7 @@ public static function matcher($function) /** * Get the fully qualified path for a compiled view. * - * @param string $view + * @param string $path * @return string */ public static function compiled($path) diff --git a/laravel/cache/drivers/driver.php b/laravel/cache/drivers/driver.php index c6abcb2e..5df317be 100644 --- a/laravel/cache/drivers/driver.php +++ b/laravel/cache/drivers/driver.php @@ -67,6 +67,7 @@ abstract public function put($key, $value, $minutes); * @param string $key * @param mixed $default * @param int $minutes + * @param string $function * @return mixed */ public function remember($key, $default, $minutes, $function = 'put') diff --git a/laravel/cache/drivers/memcached.php b/laravel/cache/drivers/memcached.php index 3e6a454d..5a324bf5 100644 --- a/laravel/cache/drivers/memcached.php +++ b/laravel/cache/drivers/memcached.php @@ -20,6 +20,7 @@ class Memcached extends Sectionable { * Create a new Memcached cache driver instance. * * @param Memcached $memcache + * @param string $key * @return void */ public function __construct(\Memcached $memcache, $key) diff --git a/laravel/cache/drivers/sectionable.php b/laravel/cache/drivers/sectionable.php index 4ec78246..93566989 100644 --- a/laravel/cache/drivers/sectionable.php +++ b/laravel/cache/drivers/sectionable.php @@ -63,6 +63,7 @@ public function forever_in_section($section, $key, $value) * @param string $key * @param mixed $default * @param int $minutes + * @param string $function * @return mixed */ public function remember_in_section($section, $key, $default, $minutes, $function = 'put') diff --git a/laravel/cli/tasks/help.php b/laravel/cli/tasks/help.php index 8cfcd768..929c4ff8 100644 --- a/laravel/cli/tasks/help.php +++ b/laravel/cli/tasks/help.php @@ -8,7 +8,6 @@ class Help extends Task { /** * List available artisan commands. * - * @param array $arguments * @return void */ public function commands() diff --git a/laravel/cli/tasks/test/runner.php b/laravel/cli/tasks/test/runner.php index 937046d8..250450d1 100644 --- a/laravel/cli/tasks/test/runner.php +++ b/laravel/cli/tasks/test/runner.php @@ -10,6 +10,7 @@ class Runner extends Task { /** * Run all of the unit tests for the application. * + * @param array $bundles * @return void */ public function run($bundles = array()) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 1890c798..a5baf82e 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -567,6 +567,7 @@ public function set_key($value) * Get a given attribute from the model. * * @param string $key + * @return mixed */ public function get_attribute($key) { diff --git a/laravel/database/eloquent/relationships/belongs_to.php b/laravel/database/eloquent/relationships/belongs_to.php index ef257836..e000ca40 100644 --- a/laravel/database/eloquent/relationships/belongs_to.php +++ b/laravel/database/eloquent/relationships/belongs_to.php @@ -79,8 +79,9 @@ public function eagerly_constrain($results) /** * Match eagerly loaded child models to their parent models. * - * @param array $children - * @param array $parents + * @param string $relationship + * @param array $children + * @param array $parents * @return void */ public function match($relationship, &$children, $parents) diff --git a/laravel/database/eloquent/relationships/has_many.php b/laravel/database/eloquent/relationships/has_many.php index 726bef20..92a1bcde 100644 --- a/laravel/database/eloquent/relationships/has_many.php +++ b/laravel/database/eloquent/relationships/has_many.php @@ -83,8 +83,9 @@ public function initialize(&$parents, $relationship) /** * Match eagerly loaded child models to their parent models. * - * @param array $parents - * @param array $children + * @param string $relationship + * @param array $parents + * @param array $children * @return void */ public function match($relationship, &$parents, $children) diff --git a/laravel/database/eloquent/relationships/has_many_and_belongs_to.php b/laravel/database/eloquent/relationships/has_many_and_belongs_to.php index 9887d7d9..dad17522 100644 --- a/laravel/database/eloquent/relationships/has_many_and_belongs_to.php +++ b/laravel/database/eloquent/relationships/has_many_and_belongs_to.php @@ -61,6 +61,8 @@ public function __construct($model, $associated, $table, $foreign, $other) * * By default, the name is the models sorted and joined with underscores. * + * @param Model $model + * @param string $associated * @return string */ protected function joining($model, $associated) @@ -86,7 +88,7 @@ public function results() * Insert a new record into the joining table of the association. * * @param int $id - * @param array $joining + * @param array $attributes * @return bool */ public function attach($id, $attributes = array()) @@ -317,8 +319,9 @@ public function eagerly_constrain($results) /** * Match eagerly loaded child models to their parent models. * - * @param array $parents - * @param array $children + * @param string $relationship + * @param array $parents + * @param array $children * @return void */ public function match($relationship, &$parents, $children) @@ -383,7 +386,7 @@ protected function hydrate_pivot(&$results) /** * Set the columns on the joining table that should be fetched. * - * @param array $column + * @param array $columns * @return Relationship */ public function with($columns) diff --git a/laravel/database/eloquent/relationships/has_one.php b/laravel/database/eloquent/relationships/has_one.php index 8d1e4ff9..ee97358b 100644 --- a/laravel/database/eloquent/relationships/has_one.php +++ b/laravel/database/eloquent/relationships/has_one.php @@ -30,8 +30,9 @@ public function initialize(&$parents, $relationship) /** * Match eagerly loaded child models to their parent models. * - * @param array $parents - * @param array $children + * @param string $relationship + * @param array $parents + * @param array $children * @return void */ public function match($relationship, &$parents, $children) diff --git a/laravel/database/query.php b/laravel/database/query.php index 3c823c3f..c77ad65b 100644 --- a/laravel/database/query.php +++ b/laravel/database/query.php @@ -475,6 +475,7 @@ public function group_by($column) * @param string $column * @param string $operator * @param mixed $value + * @return Query */ public function having($column, $operator, $value) { diff --git a/laravel/database/schema.php b/laravel/database/schema.php index 2655ff27..e09b8b16 100644 --- a/laravel/database/schema.php +++ b/laravel/database/schema.php @@ -44,7 +44,7 @@ public static function create($table, $callback) * Rename a database table in the schema. * * @param string $table - * @param string $name + * @param string $new_name * @return void */ public static function rename($table, $new_name) diff --git a/laravel/database/schema/grammars/grammar.php b/laravel/database/schema/grammars/grammar.php index 62a55719..26b9fe12 100644 --- a/laravel/database/schema/grammars/grammar.php +++ b/laravel/database/schema/grammars/grammar.php @@ -9,7 +9,7 @@ abstract class Grammar extends \Laravel\Database\Grammar { * Generate the SQL statement for creating a foreign key. * * @param Table $table - * @param Command $command + * @param Fluent $command * @return string */ public function foreign(Table $table, Fluent $command) @@ -54,7 +54,7 @@ public function foreign(Table $table, Fluent $command) * Drop a constraint from the table. * * @param Table $table - * @param Fluent $fluent + * @param Fluent $command * @return string */ protected function drop_constraint(Table $table, Fluent $command) diff --git a/laravel/database/schema/grammars/mysql.php b/laravel/database/schema/grammars/mysql.php index e8c926fe..efecc675 100644 --- a/laravel/database/schema/grammars/mysql.php +++ b/laravel/database/schema/grammars/mysql.php @@ -323,7 +323,7 @@ protected function drop_key(Table $table, Fluent $command) * Drop a foreign key constraint from the table. * * @param Table $table - * @param Fluent $fluent + * @param Fluent $command * @return string */ public function drop_foreign(Table $table, Fluent $command) diff --git a/laravel/database/schema/grammars/postgres.php b/laravel/database/schema/grammars/postgres.php index 4d014b1c..36d47fd9 100644 --- a/laravel/database/schema/grammars/postgres.php +++ b/laravel/database/schema/grammars/postgres.php @@ -309,7 +309,7 @@ protected function drop_key(Table $table, Fluent $command) * Drop a foreign key constraint from the table. * * @param Table $table - * @param Fluent $fluent + * @param Fluent $command * @return string */ public function drop_foreign(Table $table, Fluent $command) diff --git a/laravel/database/schema/grammars/sqlserver.php b/laravel/database/schema/grammars/sqlserver.php index 1a556367..20a6527d 100644 --- a/laravel/database/schema/grammars/sqlserver.php +++ b/laravel/database/schema/grammars/sqlserver.php @@ -327,7 +327,7 @@ protected function drop_key(Table $table, Fluent $command) * Drop a foreign key constraint from the table. * * @param Table $table - * @param Fluent $fluent + * @param Fluent $command * @return string */ public function drop_foreign(Table $table, Fluent $command) diff --git a/laravel/database/schema/table.php b/laravel/database/schema/table.php index a513d794..c728260c 100644 --- a/laravel/database/schema/table.php +++ b/laravel/database/schema/table.php @@ -113,6 +113,7 @@ public function index($columns, $name = null) * * @param string|array $columns * @param string $name + * @return Fluent */ public function foreign($columns, $name = null) { diff --git a/laravel/event.php b/laravel/event.php index ea2eb715..ccc3bf1c 100644 --- a/laravel/event.php +++ b/laravel/event.php @@ -176,7 +176,7 @@ public static function flush($queue) * $responses = Event::fire(array('start', 'loading'), $parameters); * * - * @param string|array $event + * @param string|array $events * @param array $parameters * @param bool $halt * @return array diff --git a/laravel/form.php b/laravel/form.php index 5fa6d129..5662f77d 100644 --- a/laravel/form.php +++ b/laravel/form.php @@ -20,7 +20,7 @@ class Form { * Registers a custom macro. * * @param string $name - * @param Closure $input + * @param Closure $macro * @return void */ public static function macro($name, $macro) diff --git a/laravel/helpers.php b/laravel/helpers.php index 5b329437..589669ce 100644 --- a/laravel/helpers.php +++ b/laravel/helpers.php @@ -543,7 +543,7 @@ function render($view, $data = array()) /** * Get the rendered contents of a partial from a loop. * - * @param string $view + * @param string $partial * @param array $data * @param string $iterator * @param string $empty diff --git a/laravel/html.php b/laravel/html.php index 1f4ea6dc..fd5bf82e 100644 --- a/laravel/html.php +++ b/laravel/html.php @@ -13,7 +13,7 @@ class HTML { * Registers a custom macro. * * @param string $name - * @param Closure $input + * @param Closure $macro * @return void */ public static function macro($name, $macro) diff --git a/laravel/ioc.php b/laravel/ioc.php index b2597d32..aa90f804 100644 --- a/laravel/ioc.php +++ b/laravel/ioc.php @@ -85,6 +85,7 @@ public static function instance($name, $instance) * * * @param string $type + * @param array $parameters * @return mixed */ public static function resolve($type, $parameters = array()) diff --git a/laravel/log.php b/laravel/log.php index 74df63c9..6de027df 100644 --- a/laravel/log.php +++ b/laravel/log.php @@ -64,7 +64,8 @@ public static function write($type, $message) * Format a log message for logging. * * @param string $type - * @param + * @param string $message + * @return string */ protected static function format($type, $message) { diff --git a/laravel/pluralizer.php b/laravel/pluralizer.php index ef5b7cb6..2ce72f0b 100644 --- a/laravel/pluralizer.php +++ b/laravel/pluralizer.php @@ -24,6 +24,7 @@ class Pluralizer { /** * Create a new pluralizer instance. * + * @param array $config * @return void */ public function __construct($config) diff --git a/laravel/profiling/profiler.php b/laravel/profiling/profiler.php index 36a83e7e..eda884c5 100644 --- a/laravel/profiling/profiler.php +++ b/laravel/profiling/profiler.php @@ -39,6 +39,8 @@ public static function render($response) /** * Add a log entry to the log entries array. * + * @param string $type + * @param string $message * @return void */ public static function log($type, $message) diff --git a/laravel/redirect.php b/laravel/redirect.php index 2f75db53..1042f7ec 100644 --- a/laravel/redirect.php +++ b/laravel/redirect.php @@ -6,7 +6,7 @@ class Redirect extends Response { * Create a redirect response to application root. * * @param int $status - * @param bool $secure + * @param bool $https * @return Redirect */ public static function home($status = 302, $https = null) diff --git a/laravel/request.php b/laravel/request.php index 306a94c1..e78c943d 100644 --- a/laravel/request.php +++ b/laravel/request.php @@ -119,6 +119,7 @@ public static function accept() /** * Determine if the request accepts a given content type. * + * @param string $type * @return bool */ public static function accepts($type) diff --git a/laravel/routing/router.php b/laravel/routing/router.php index 3f265323..0f162305 100644 --- a/laravel/routing/router.php +++ b/laravel/routing/router.php @@ -292,7 +292,7 @@ public static function secure_controller($controllers, $defaults = 'index') /** * Register a controller with the router. * - * @param string|array $controller + * @param string|array $controllers * @param string|array $defaults * @param bool $https * @return void diff --git a/laravel/validator.php b/laravel/validator.php index e32c4ccc..5fb93bb6 100644 --- a/laravel/validator.php +++ b/laravel/validator.php @@ -637,6 +637,7 @@ protected function validate_alpha_dash($attribute, $value) * * @param string $attribute * @param mixed $value + * @param array $parameters * @return bool */ protected function validate_match($attribute, $value, $parameters) diff --git a/laravel/view.php b/laravel/view.php index 7ade58fb..d8275c6e 100644 --- a/laravel/view.php +++ b/laravel/view.php @@ -255,7 +255,7 @@ public static function name($view, $name) * }); * * - * @param string|array $view + * @param string|array $views * @param Closure $composer * @return void */ From 93f5785911158bbeb43da590c062239034aded53 Mon Sep 17 00:00:00 2001 From: Johnson Page Date: Sun, 5 Aug 2012 07:51:09 +1000 Subject: [PATCH 3/5] Update path to index view file. Signed-off-by: Johnson Page --- application/views/home/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/home/index.blade.php b/application/views/home/index.blade.php index ec7973d7..d3c9bf17 100644 --- a/application/views/home/index.blade.php +++ b/application/views/home/index.blade.php @@ -29,7 +29,7 @@

And the view sitting before you can be found at:

-
{{ path('app') }}views/home/index.php
+
{{ path('app') }}views/home/index.blade.php

Grow in knowledge.

From 79f92e57dfa6b0c49b92c310432080ad5ca51c2c Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 9 Aug 2012 22:42:03 -0500 Subject: [PATCH 4/5] defer language support in URIs to version 4. --- application/config/application.php | 13 --------- laravel/laravel.php | 42 ++---------------------------- laravel/url.php | 8 ------ 3 files changed, 2 insertions(+), 61 deletions(-) diff --git a/application/config/application.php b/application/config/application.php index 60735a60..525227c2 100755 --- a/application/config/application.php +++ b/application/config/application.php @@ -94,19 +94,6 @@ 'language' => 'en', - /* - |-------------------------------------------------------------------------- - | Supported Languages - |-------------------------------------------------------------------------- - | - | These languages may also be supported by your application. If a request - | enters your application with a URI beginning with one of these values - | the default language will automatically be set to that language. - | - */ - - 'languages' => array(), - /* |-------------------------------------------------------------------------- | SSL Link Generation diff --git a/laravel/laravel.php b/laravel/laravel.php index 1f908eed..2772e323 100644 --- a/laravel/laravel.php +++ b/laravel/laravel.php @@ -107,46 +107,6 @@ return Event::first('404'); }); -/* -|-------------------------------------------------------------------------- -| Gather The URI And Locales -|-------------------------------------------------------------------------- -| -| When routing, we'll need to grab the URI and the supported locales for -| the route so we can properly set the language and route the request -| to the proper end-point in the application. -| -*/ - -$uri = URI::current(); - -$locales = Config::get('application.languages', array()); - -$locales[] = Config::get('application.language'); - -/* -|-------------------------------------------------------------------------- -| Set The Locale Based On Route -|-------------------------------------------------------------------------- -| -| If the URI starts with one of the supported languages, we will set -| the default language to match that URI segment and shorten the -| URI we'll pass to the router to not include the lang segment. -| -*/ - -foreach ($locales as $locale) -{ - if (starts_with($uri, $locale)) - { - Config::set('application.language', $locale); - - $uri = trim(substr($uri, strlen($locale)), '/'); break; - } -} - -if ($uri === '') $uri = '/'; - /* |-------------------------------------------------------------------------- | Route The Incoming Request @@ -158,6 +118,8 @@ | */ +$uri = URI::current(); + Request::$route = Routing\Router::route(Request::method(), $uri); $response = Request::$route->call(); diff --git a/laravel/url.php b/laravel/url.php index 3ad6a3e2..2b97128c 100644 --- a/laravel/url.php +++ b/laravel/url.php @@ -107,14 +107,6 @@ public static function to($url = '', $https = null) $root = static::base().'/'.Config::get('application.index'); - // If multiple languages are being supported via URIs, we will append current - // language to the URI so all redirects and URLs generated include the - // current language so it is not lost on further requests. - if (count(Config::get('application.languages')) > 0) - { - $root .= '/'.Config::get('application.language'); - } - // Since SSL is not often used while developing the application, we allow the // developer to disable SSL on all framework generated links to make it more // convenient to work with the site while developing locally. From 343d1327374b35c5a6e122c4ebc0f777eabdcd43 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 9 Aug 2012 22:42:35 -0500 Subject: [PATCH 5/5] tweak change log. --- laravel/documentation/changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/documentation/changes.md b/laravel/documentation/changes.md index d969d5a2..85608740 100644 --- a/laravel/documentation/changes.md +++ b/laravel/documentation/changes.md @@ -38,7 +38,7 @@ ## Laravel 3.2.4 - Speed up many to many eager loading mapping. - Tweak the Eloquent::changed() method. -- Added support for locales in the URI. +- Various bug fixes and improvements. ## Upgrading From 3.2.3