language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | laravel | framework | 81b3c1a52597260e5b8ade7da792886a921b17c2.json | Fix URL generation. | src/Illuminate/Routing/UrlGenerator.php | @@ -171,7 +171,7 @@ public function secureAsset($path)
*/
protected function getScheme($secure)
{
- if ( ! $secure)
+ if (is_null($secure))
{
return $this->request->getScheme().'://';
}
@@ -385,7 +385,9 @@ protected function addPortToDomain($domain)
*/
protected function getRouteRoot($route, $domain)
{
- return $this->getRootUrl($this->getScheme($route->secure()), $domain);
+ $secure = $route->secure() ?: null;
+
+ return $this->getRootUrl($this->getScheme($secure), $domain);
}
/**
| false |
Other | laravel | framework | 22e60f4741666aa01ee625ce7aac0fb5c6fd4986.json | Fix mockery test. | tests/View/ViewTest.php | @@ -49,8 +49,13 @@ public function testRenderProperlyRendersView()
public function testRenderSectionsReturnsEnvironmentSections()
{
- $view = m::mock('Illuminate\View\View[render]');
- $view->__construct(m::mock('Illuminate\View\Environment'), m::mock('Illuminate\View\Engines\EngineInterface'), 'view', 'path', array());
+ $view = m::mock('Illuminate\View\View[render]', array(
+ m::mock('Illuminate\View\Environment'),
+ m::mock('Illuminate\View\Engines\EngineInterface'),
+ 'view',
+ 'path',
+ array()
+ ));
$view->shouldReceive('render')->with(m::type('Closure'))->once()->andReturn($sections = array('foo' => 'bar'));
$view->getEnvironment()->shouldReceive('getSections')->once()->andReturn($sections); | false |
Other | laravel | framework | bdee3286da2f7013792e26aeae449c8e2a8c9d82.json | Remove php 5.3 from travis | .travis.yml | @@ -1,7 +1,6 @@
language: php
php:
- - 5.3
- 5.4
- 5.5
- hhvm | false |
Other | laravel | framework | 72964e278ae2e34c40ecc9c00614596ee960ed4c.json | Add Response trait to dry code. | src/Illuminate/Http/JsonResponse.php | @@ -5,6 +5,8 @@
class JsonResponse extends \Symfony\Component\HttpFoundation\JsonResponse {
+ use ResponseTrait;
+
/**
* Get the json_decoded data from the response
*
@@ -28,32 +30,4 @@ public function setData($data = array())
return $this->update();
}
- /**
- * Set a header on the Response.
- *
- * @param string $key
- * @param string $value
- * @param bool $replace
- * @return \Illuminate\Http\Response
- */
- public function header($key, $value, $replace = true)
- {
- $this->headers->set($key, $value, $replace);
-
- return $this;
- }
-
- /**
- * Add a cookie to the response.
- *
- * @param \Symfony\Component\HttpFoundation\Cookie $cookie
- * @return \Illuminate\Http\Response
- */
- public function withCookie(Cookie $cookie)
- {
- $this->headers->setCookie($cookie);
-
- return $this;
- }
-
}
\ No newline at end of file | true |
Other | laravel | framework | 72964e278ae2e34c40ecc9c00614596ee960ed4c.json | Add Response trait to dry code. | src/Illuminate/Http/Response.php | @@ -7,41 +7,15 @@
class Response extends \Symfony\Component\HttpFoundation\Response {
+ use ResponseTrait;
+
/**
* The original content of the response.
*
* @var mixed
*/
public $original;
- /**
- * Set a header on the Response.
- *
- * @param string $key
- * @param string $value
- * @param bool $replace
- * @return \Illuminate\Http\Response
- */
- public function header($key, $value, $replace = true)
- {
- $this->headers->set($key, $value, $replace);
-
- return $this;
- }
-
- /**
- * Add a cookie to the response.
- *
- * @param \Symfony\Component\HttpFoundation\Cookie $cookie
- * @return \Illuminate\Http\Response
- */
- public function withCookie(Cookie $cookie)
- {
- $this->headers->setCookie($cookie);
-
- return $this;
- }
-
/**
* Set the content on the response.
* | true |
Other | laravel | framework | 72964e278ae2e34c40ecc9c00614596ee960ed4c.json | Add Response trait to dry code. | src/Illuminate/Http/ResponseTrait.php | @@ -0,0 +1,33 @@
+<?php namespace Illuminate\Http;
+
+trait ResponseTrait {
+
+ /**
+ * Set a header on the Response.
+ *
+ * @param string $key
+ * @param string $value
+ * @param bool $replace
+ * @return \Illuminate\Http\Response
+ */
+ public function header($key, $value, $replace = true)
+ {
+ $this->headers->set($key, $value, $replace);
+
+ return $this;
+ }
+
+ /**
+ * Add a cookie to the response.
+ *
+ * @param \Symfony\Component\HttpFoundation\Cookie $cookie
+ * @return \Illuminate\Http\Response
+ */
+ public function withCookie(Cookie $cookie)
+ {
+ $this->headers->setCookie($cookie);
+
+ return $this;
+ }
+
+}
\ No newline at end of file | true |
Other | laravel | framework | f66c859f8bdf47d2b58922759d0e2854fcfb084b.json | Pass config name to database extensions. | src/Illuminate/Database/DatabaseManager.php | @@ -111,7 +111,7 @@ protected function makeConnection($name)
// Closure and pass it the config allowing it to resolve the connection.
if (isset($this->extensions[$name]))
{
- return call_user_func($this->extensions[$name], $config);
+ return call_user_func($this->extensions[$name], $config, $name);
}
$driver = $config['driver'];
@@ -121,7 +121,7 @@ protected function makeConnection($name)
// resolver for the drivers themselves which applies to all connections.
if (isset($this->extensions[$driver]))
{
- return call_user_func($this->extensions[$driver], $config);
+ return call_user_func($this->extensions[$driver], $config, $name);
}
return $this->factory->make($config, $name);
| false |
Other | laravel | framework | 19f37ca715808aee7628774a50d19b8939f47945.json | Check IoC for custom Connector instances | src/Illuminate/Database/Connectors/ConnectionFactory.php | @@ -171,6 +171,11 @@ public function createConnector(array $config)
throw new \InvalidArgumentException("A driver must be specified.");
}
+ if ($this->container->bound($key = "db.connector.{$config['driver']}"))
+ {
+ return $this->container->make($key);
+ }
+
switch ($config['driver'])
{
case 'mysql': | false |
Other | laravel | framework | fd2047d9c8a00b45484b1913797a947a8b3e1f71.json | Register both classes as aliases. | src/Illuminate/Foundation/Application.php | @@ -997,7 +997,7 @@ public function registerCoreContainerAliases()
'translator' => 'Illuminate\Translation\Translator',
'log' => 'Illuminate\Log\Writer',
'mailer' => 'Illuminate\Mail\Mailer',
- 'paginator' => 'Illuminate\Pagination\Factory',
+ 'paginator' => array('Illuminate\Pagination\Factory', 'Illuminate\Pagination\Environment'),
'auth.reminder' => 'Illuminate\Auth\Reminders\PasswordBroker',
'queue' => 'Illuminate\Queue\QueueManager',
'redirect' => 'Illuminate\Routing\Redirector',
@@ -1009,12 +1009,15 @@ public function registerCoreContainerAliases()
'remote' => 'Illuminate\Remote\RemoteManager',
'url' => 'Illuminate\Routing\UrlGenerator',
'validator' => 'Illuminate\Validation\Factory',
- 'view' => 'Illuminate\View\Factory',
+ 'view' => array('Illuminate\View\Factory', 'Illuminate\View\Environment'),
);
- foreach ($aliases as $key => $alias)
+ foreach ($aliases as $key => $aliases)
{
- $this->alias($key, $alias);
+ foreach ((array) $aliases as $alias)
+ {
+ $this->alias($key, $alias);
+ }
}
}
| false |
Other | laravel | framework | 3a4c90769f40c2e722d6e2e6e590fbdc090afbee.json | Add doc block for deprecation. | src/Illuminate/Pagination/Environment.php | @@ -4,6 +4,9 @@
use Illuminate\View\Factory as ViewFactory;
use Symfony\Component\Translation\TranslatorInterface;
+/**
+ * DEPRECATED: Please use Illuminate\Pagination\Factory instead!
+ */
class Environment extends Factory {
/** | false |
Other | laravel | framework | e0f26b70d321dcd5d719739e82f29b658e2ea181.json | Remove some extra text. | readme.md | @@ -16,7 +16,7 @@ Laravel is accessible, yet powerful, providing powerful tools needed for large,
Documentation for the entire framework can be found on the [Laravel website](http://laravel.com/docs).
-## Contributing To Laravel
+## Contributing
Thank you for considering contributing to the Laravel framework. If you are submitting a bug-fix, or an enhancement that is **not** a breaking change, submit your pull request to the branch corresponding to the latest stable release of the framework, such as the `4.1` branch. If you are submitting a breaking change or an entirely new component, submit your pull request to the `master` branch.
| false |
Other | laravel | framework | 640c2b559f16a6070805ce26efeb4afe992f2152.json | Add quick contribution note. | readme.md | @@ -1,5 +1,9 @@
-## Laravel Framework (Core)
+## Laravel Framework (Kernel)
[](https://packagist.org/packages/laravel/framework) [](https://packagist.org/packages/laravel/framework) [](https://travis-ci.org/laravel/framework) [](https://www.versioneye.com/php/laravel:framework)
-This repository contains the core code of the Laravel framework. If you want to build an application using Laravel 4, visit the main [Laravel repository](https://github.com/laravel/laravel).
\ No newline at end of file
+> **Note:** This repository contains the core code of the Laravel framework. If you want to build an application using Laravel 4, visit the main [Laravel repository](https://github.com/laravel/laravel).
+
+## Contributing To Laravel
+
+Thank you for considering contributing to the Laravel framework. If you are submitting a bug-fix, or an enhancement that is **not** a breaking change, submit your pull request to the branch corresponding to the latest stable release of the framework, such as the `4.1` branch. If you are submitting a breaking change or an entirely new component, submit your pull request to the `master` branch.
\ No newline at end of file | false |
Other | laravel | framework | b626dabaa85910a5f4d5a3a8ccc068d17ff2d0f3.json | Add dependency check to read me. | readme.md | @@ -1,5 +1,5 @@
## Laravel Framework (Core)
-[](https://packagist.org/packages/laravel/framework) [](https://packagist.org/packages/laravel/framework) [](https://travis-ci.org/laravel/framework)
+[](https://packagist.org/packages/laravel/framework) [](https://packagist.org/packages/laravel/framework) [](https://travis-ci.org/laravel/framework) [](https://www.versioneye.com/php/laravel:framework)
This repository contains the core code of the Laravel framework. If you want to build an application using Laravel 4, visit the main [Laravel repository](https://github.com/laravel/laravel).
\ No newline at end of file | false |
Other | laravel | framework | 7e3a99ebbab959324eebd88bdc38667f3fd35461.json | Register core class aliases. | src/Illuminate/Foundation/Application.php | @@ -972,6 +972,51 @@ public static function onRequest($method, $parameters = array())
return forward_static_call_array(array(static::requestClass(), $method), $parameters);
}
+ /**
+ * Register the core class aliases in the container.
+ *
+ * @return void
+ */
+ public function registerCoreContainerAliases()
+ {
+ $aliases = array(
+ 'app' => 'Illuminate\Foundation\Application',
+ 'artisan' => 'Illuminate\Console\Application',
+ 'auth' => 'Illuminate\Auth\AuthManager',
+ 'blade.compiler' => 'Illuminate\View\Compilers\BladeCompiler',
+ 'cache' => 'Illuminate\Cache\Repository',
+ 'config' => 'Illuminate\Config\Repository',
+ 'cookie' => 'Illuminate\Cookie\CookieJar',
+ 'encrypter' => 'Illuminate\Encryption\Encrypter',
+ 'db' => 'Illuminate\Database\DatabaseManager',
+ 'events' => 'Illuminate\Events\Dispatacher',
+ 'files' => 'Illuminate\Filesystem\Filesystem',
+ 'form' => 'Illuminate\Html\FormBuilder',
+ 'hash' => 'Illuminate\Hashing\HasherInterface',
+ 'html' => 'Illuminate\Html\HtmlBuilder',
+ 'translator' => 'Illuminate\Translation\Translator',
+ 'log' => 'Illuminate\Log\Writer',
+ 'mailer' => 'Illuminate\Mail\Mailer',
+ 'paginator' => 'Illuminate\Pagination\Environment',
+ 'auth.reminder' => 'Illuminate\Auth\Reminders\PasswordBroker',
+ 'queue' => 'Illuminate\Queue\QueueManager',
+ 'redirect' => 'Illuminate\Routing\Redirector',
+ 'redis' => 'Illuminate\Redis\Database',
+ 'request' => 'Illuminate\Http\Requset',
+ 'router' => 'Illuminate\Routing\Router',
+ 'session' => 'Illuminate\Session\SessionManager',
+ 'remote' => 'Illuminate\Remote\RemoteManager',
+ 'url' => 'Illuminate\Routing\UrlGenerator',
+ 'validator' => 'Illuminate\Validation\Factory',
+ 'view' => 'Illuminate\View\Environment',
+ );
+
+ foreach ($aliases as $key => $alias)
+ {
+ $this->alias($key, $alias);
+ }
+ }
+
/**
* Dynamically access application services.
* | true |
Other | laravel | framework | 7e3a99ebbab959324eebd88bdc38667f3fd35461.json | Register core class aliases. | src/Illuminate/Foundation/start.php | @@ -91,6 +91,19 @@
Facade::setFacadeApplication($app);
+/*
+|--------------------------------------------------------------------------
+| Register Facade Aliases To Full Classes
+|--------------------------------------------------------------------------
+|
+| By default, we use short keys in the container for each of the core
+| pieces of the framework. Here we will register the aliases for a
+| list of all of the fully qualified class names making DI easy.
+|
+*/
+
+$app->registerCoreContainerAliases();
+
/*
|--------------------------------------------------------------------------
| Register The Configuration Repository | true |
Other | laravel | framework | de713c4c907170b88334aaf110d99bca28fef502.json | Fix calls to sortBy revealed by HHVM tests. | src/Illuminate/Support/Collection.php | @@ -435,6 +435,18 @@ public function sortBy(Closure $callback, $options = SORT_REGULAR, $descending =
return $this;
}
+ /**
+ * Sort the collection in descending order using the given Closure.
+ *
+ * @param \Closure $callback
+ * @param int $options
+ * @return \Illuminate\Support\Collection
+ */
+ public function sortByDesc(Closure $callback, $options = SORT_REGULAR)
+ {
+ return $this->sortBy($callback, $options, true);
+ }
+
/**
* Splice portion of the underlying collection array.
*
| true |
Other | laravel | framework | de713c4c907170b88334aaf110d99bca28fef502.json | Fix calls to sortBy revealed by HHVM tests. | tests/Support/SupportCollectionTest.php | @@ -201,12 +201,12 @@ public function testSort()
public function testSortBy()
{
$data = new Collection(array('taylor', 'dayle'));
- $data->sortBy(function($x) { return $x; });
+ $data = $data->sortBy(function($x) { return $x; });
$this->assertEquals(array('dayle', 'taylor'), array_values($data->all()));
$data = new Collection(array('dayle', 'taylor'));
- $data->sortBy(function($x) { return $x; }, true);
+ $data->sortByDesc(function($x) { return $x; });
$this->assertEquals(array('taylor', 'dayle'), array_values($data->all()));
}
| true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Auth/Reminders/DatabaseReminderRepository.php | @@ -53,7 +53,7 @@ public function __construct(Connection $connection, $table, $hashKey, $expires =
/**
* Create a new reminder record and token.
*
- * @param \Illuminate\Auth\RemindableInterface $user
+ * @param \Illuminate\Auth\Reminders\RemindableInterface $user
* @return string
*/
public function create(RemindableInterface $user)
@@ -85,7 +85,7 @@ protected function getPayload($email, $token)
/**
* Determine if a reminder record exists and is valid.
*
- * @param \Illuminate\Auth\RemindableInterface $user
+ * @param \Illuminate\Auth\Reminders\RemindableInterface $user
* @param string $token
* @return bool
*/
@@ -147,7 +147,7 @@ public function deleteExpired()
/**
* Create a new token for the user.
*
- * @param \Illuminate\Auth\RemindableInterface $user
+ * @param \Illuminate\Auth\Reminders\RemindableInterface $user
* @return string
*/
public function createNewToken(RemindableInterface $user) | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Auth/Reminders/PasswordBroker.php | @@ -183,7 +183,7 @@ public function reset(array $credentials, Closure $callback)
* Validate a password reset for the given credentials.
*
* @param array $credentials
- * @return \Illuminate\Auth\RemindableInterface
+ * @return \Illuminate\Auth\Reminders\RemindableInterface
*/
protected function validateReset(array $credentials)
{ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Auth/Reminders/ReminderRepositoryInterface.php | @@ -5,15 +5,15 @@ interface ReminderRepositoryInterface {
/**
* Create a new reminder record and token.
*
- * @param \Illuminate\Auth\RemindableInterface $user
+ * @param \Illuminate\Auth\Reminders\RemindableInterface $user
* @return string
*/
public function create(RemindableInterface $user);
/**
* Determine if a reminder record exists and is valid.
*
- * @param \Illuminate\Auth\RemindableInterface $user
+ * @param \Illuminate\Auth\Reminders\RemindableInterface $user
* @param string $token
* @return bool
*/ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Database/Connection.php | @@ -60,7 +60,7 @@ class Connection implements ConnectionInterface {
/**
* The cache manager instance.
*
- * @var \Illuminate\Cache\CacheManger
+ * @var \Illuminate\Cache\CacheManager
*/
protected $cache;
| true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Database/Connectors/ConnectorInterface.php | @@ -6,7 +6,7 @@ interface ConnectorInterface {
* Establish a database connection.
*
* @param array $config
- * @return PDO
+ * @return \PDO
*/
public function connect(array $config);
| true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Database/Connectors/MySqlConnector.php | @@ -6,7 +6,7 @@ class MySqlConnector extends Connector implements ConnectorInterface {
* Establish a database connection.
*
* @param array $config
- * @return PDO
+ * @return \PDO
*/
public function connect(array $config)
{ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Database/Connectors/SQLiteConnector.php | @@ -6,7 +6,7 @@ class SQLiteConnector extends Connector implements ConnectorInterface {
* Establish a database connection.
*
* @param array $config
- * @return PDO
+ * @return \PDO
*
* @throws \InvalidArgumentException
*/ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Database/Console/Migrations/InstallCommand.php | @@ -23,14 +23,14 @@ class InstallCommand extends Command {
/**
* The repository instance.
*
- * @var \Illuminate\Database\Console\Migrations\MigrationRepositoryInterface
+ * @var \Illuminate\Database\Migrations\MigrationRepositoryInterface
*/
protected $repository;
/**
* Create a new migration install command instance.
*
- * @param \Illuminate\Database\Console\Migrations\MigrationRepositoryInterface $repository
+ * @param \Illuminate\Database\Migrations\MigrationRepositoryInterface $repository
* @return void
*/
public function __construct(MigrationRepositoryInterface $repository) | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Database/Eloquent/Model.php | @@ -1708,7 +1708,7 @@ public function newCollection(array $models = array())
* @param array $attributes
* @param string $table
* @param bool $exists
- * @return \Illuminate\Database\Eloquent\Relation\Pivot
+ * @return \Illuminate\Database\Eloquent\Relations\Pivot
*/
public function newPivot(Model $parent, array $attributes, $table, $exists)
{ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php | @@ -888,7 +888,7 @@ public function newPivotStatementForId($id)
*
* @param array $attributes
* @param bool $exists
- * @return \Illuminate\Database\Eloquent\Relation\Pivot
+ * @return \Illuminate\Database\Eloquent\Relations\Pivot
*/
public function newPivot(array $attributes = array(), $exists = false)
{ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php | @@ -63,7 +63,7 @@ public function getRelationCountQuery(Builder $query, Builder $parent)
/**
* Set the join clause on the query.
*
- * @param \Illuminate\Databaes\Eloquent\Builder|null $query
+ * @param \Illuminate\Database\Eloquent\Builder|null $query
* @return void
*/
protected function setJoin(Builder $query = null) | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Database/Eloquent/Relations/MorphToMany.php | @@ -108,7 +108,7 @@ protected function newPivotQuery()
*
* @param array $attributes
* @param bool $exists
- * @return \Illuminate\Database\Eloquent\Relation\Pivot
+ * @return \Illuminate\Database\Eloquent\Relations\Pivot
*/
public function newPivot(array $attributes = array(), $exists = false)
{ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Database/Query/Builder.php | @@ -403,7 +403,7 @@ public function orWhere($column, $operator = null, $value = null)
* Determine if the given operator and value combination is legal.
*
* @param string $operator
- * @param mxied $value
+ * @param mixed $value
* @return bool
*/
protected function invalidOperatorAndValue($operator, $value) | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Exception/Handler.php | @@ -212,7 +212,7 @@ protected function isFatal($type)
/**
* Handle a console exception.
*
- * @param Exception $exception
+ * @param \Exception $exception
* @return void
*/
public function handleConsole($exception)
@@ -223,7 +223,7 @@ public function handleConsole($exception)
/**
* Handle the given exception.
*
- * @param Exception $exception
+ * @param \Exception $exception
* @param bool $fromConsole
* @return void
*/
@@ -290,7 +290,7 @@ protected function displayException($exception)
* Determine if the given handler handles this exception.
*
* @param Closure $handler
- * @param Exception $exception
+ * @param \Exception $exception
* @return bool
*/
protected function handlesException(Closure $handler, $exception)
@@ -304,7 +304,7 @@ protected function handlesException(Closure $handler, $exception)
* Determine if the given handler type hints the exception.
*
* @param ReflectionFunction $reflection
- * @param Exception $exception
+ * @param \Exception $exception
* @return bool
*/
protected function hints(ReflectionFunction $reflection, $exception)
@@ -319,7 +319,7 @@ protected function hints(ReflectionFunction $reflection, $exception)
/**
* Format an exception thrown by a handler.
*
- * @param Exception $e
+ * @param \Exception $e
* @return string
*/
protected function formatException(\Exception $e) | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Exception/PlainDisplayer.php | @@ -10,6 +10,7 @@ class PlainDisplayer implements ExceptionDisplayerInterface {
* Display the given exception to the user.
*
* @param \Exception $exception
+ * @return \Symfony\Component\HttpFoundation\Response
*/
public function display(Exception $exception)
{ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Exception/WhoopsDisplayer.php | @@ -38,6 +38,7 @@ public function __construct(Run $whoops, $runningInConsole)
* Display the given exception to the user.
*
* @param \Exception $exception
+ * @return \Symfony\Component\HttpFoundation\Response
*/
public function display(Exception $exception)
{ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Foundation/Testing/TestCase.php | @@ -53,7 +53,7 @@ protected function refreshApplication()
*
* Needs to be implemented by subclasses.
*
- * @return Symfony\Component\HttpKernel\HttpKernelInterface
+ * @return \Symfony\Component\HttpKernel\HttpKernelInterface
*/
abstract public function createApplication();
| true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Html/FormBuilder.php | @@ -612,7 +612,7 @@ protected function checkable($type, $name, $value, $checked, $options)
* @param string $name
* @param mixed $value
* @param bool $checked
- * @return void
+ * @return bool
*/
protected function getCheckedState($type, $name, $value, $checked)
{ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Log/Writer.php | @@ -34,7 +34,7 @@ class Writer {
/**
* The event dispatcher instance.
*
- * @var \Illuminate\Events\Dispacher
+ * @var \Illuminate\Events\Dispatcher
*/
protected $dispatcher;
| true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Mail/Mailer.php | @@ -42,7 +42,7 @@ class Mailer {
/**
* The IoC container instance.
*
- * @var \Illuminate\Container
+ * @var \Illuminate\Container\Container
*/
protected $container;
| true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Queue/IronQueue.php | @@ -101,7 +101,7 @@ public function recreate($payload, $queue = null, $delay)
*
* @param \DateTime|int $delay
* @param string $job
- * @param mixed data
+ * @param mixed $data
* @param string $queue
* @return mixed
*/ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Queue/Jobs/RedisJob.php | @@ -23,7 +23,7 @@ class RedisJob extends Job {
* Create a new job instance.
*
* @param \Illuminate\Container\Container $container
- * @param \Illuminate\Redis\Queue $redis
+ * @param \Illuminate\Queue\RedisQueue $redis
* @param string $job
* @param string $queue
* @return void | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Queue/QueueInterface.php | @@ -37,7 +37,7 @@ public function later($delay, $job, $data = '', $queue = null);
* Pop the next job off of the queue.
*
* @param string $queue
- * @return \Illuminate\Queue\Jobs\Job|nul
+ * @return \Illuminate\Queue\Jobs\Job|null
*/
public function pop($queue = null);
| true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Routing/ControllerDispatcher.php | @@ -158,6 +158,7 @@ protected function getAssignableAfter($filter)
* @param array $filter
* @param \Illuminate\Http\Request $request
* @param string $method
+ * @return bool
*/
protected function filterApplies($filter, $request, $method)
{
@@ -178,6 +179,7 @@ protected function filterApplies($filter, $request, $method)
* @param array $filter
* @param \Illuminate\Http\Request $request
* @param string $method
+ * @return bool
*/
protected function filterFailsOnly($filter, $request, $method)
{
@@ -192,6 +194,7 @@ protected function filterFailsOnly($filter, $request, $method)
* @param array $filter
* @param \Illuminate\Http\Request $request
* @param string $method
+ * @return bool
*/
protected function filterFailsExcept($filter, $request, $method)
{
@@ -206,6 +209,7 @@ protected function filterFailsExcept($filter, $request, $method)
* @param array $filter
* @param \Illuminate\Http\Request $request
* @param string $method
+ * @return bool
*/
protected function filterFailsOn($filter, $request, $method)
{ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Routing/Router.php | @@ -769,6 +769,7 @@ protected function getLastGroupPrefix()
* @param array|string $methods
* @param string $uri
* @param \Closure|array|string $action
+ * @return \Illuminate\Routing\Route
*/
protected function addRoute($methods, $uri, $action)
{ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Session/CacheBasedSessionHandler.php | @@ -21,7 +21,7 @@ class CacheBasedSessionHandler implements \SessionHandlerInterface {
/**
* Create a new cache driven handler instance.
*
- * @param Illuminate\Cache\Repository $cache
+ * @param \Illuminate\Cache\Repository $cache
* @param int $minutes
* @return void
*/ | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Support/Facades/Response.php | @@ -65,7 +65,7 @@ public static function json($data = array(), $status = 200, array $headers = arr
/**
* Return a new streamed response from the application.
*
- * @param Closure $callback
+ * @param \Closure $callback
* @param int $status
* @param array $headers
* @return \Symfony\Component\HttpFoundation\StreamedResponse
@@ -78,7 +78,7 @@ public static function stream($callback, $status = 200, array $headers = array()
/**
* Create a new file download response.
*
- * @param SplFileInfo|string $file
+ * @param \SplFileInfo|string $file
* @param string $name
* @param array $headers
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Validation/Factory.php | @@ -9,7 +9,7 @@ class Factory {
/**
* The Translator implementation.
*
- * @var \Symfony\Component\Translator\TranslatorInterface
+ * @var \Symfony\Component\Translation\TranslatorInterface
*/
protected $translator;
| true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/View/Engines/CompilerEngine.php | @@ -63,7 +63,7 @@ public function get($path, array $data = array())
/**
* Handle a view exception.
*
- * @param Exception $e
+ * @param \Exception $e
* @return void
*
* @throws $e | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/View/Engines/PhpEngine.php | @@ -47,7 +47,7 @@ protected function evaluatePath($__path, $__data)
/**
* Handle a view exception.
*
- * @param Exception $e
+ * @param \Exception $e
* @return void
*
* @throws $e | true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/View/Environment.php | @@ -32,7 +32,7 @@ class Environment {
/**
* The IoC container instance.
*
- * @var \Illuminate\Container
+ * @var \Illuminate\Container\Container
*/
protected $container;
| true |
Other | laravel | framework | 4a160d8d219b8da18b211809cc0d6ae7fb1c2aa6.json | Fix doc blocks. | src/Illuminate/Workbench/PackageCreator.php | @@ -7,7 +7,7 @@ class PackageCreator {
/**
* The filesystem instance.
*
- * @var \Illuminate\Filesystem
+ * @var \Illuminate\Filesystem\Filesystem
*/
protected $files;
@@ -38,7 +38,7 @@ class PackageCreator {
/**
* Create a new package creator instance.
*
- * @param \Illuminate\Filesystem $files
+ * @param \Illuminate\Filesystem\Filesystem $files
* @return void
*/
public function __construct(Filesystem $files)
| true |
Other | laravel | framework | cedc9d443c66f467a44edf7dbd291ae36cc5a4f9.json | Fix URL generation bug. | src/Illuminate/Routing/RouteCollection.php | @@ -90,6 +90,21 @@ protected function addLookups($route)
// 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;
}
| false |
Other | laravel | framework | a735af6d68253755031ccfd1542c176d4d8d3250.json | Add getLastAttempted method to Auth\Guard class. | src/Illuminate/Auth/Guard.php | @@ -618,4 +618,14 @@ public function viaRemember()
return $this->viaRemember;
}
+ /**
+ * Get the last user that was attempted to be retrieved.
+ *
+ * @return \Illuminate\Auth\UserInterface
+ */
+ public function getLastAttempted()
+ {
+ return $this->lastAttempted;
+ }
+
} | false |
Other | laravel | framework | 198e9f2519a29ba8ff67ab08444f75509b80498b.json | Fix bug in Closure after filters. | src/Illuminate/Routing/ControllerDispatcher.php | @@ -1,5 +1,6 @@
<?php namespace Illuminate\Routing;
+use Closure;
use Illuminate\Http\Request;
use Illuminate\Container\Container;
@@ -135,11 +136,22 @@ protected function assignAfter($instance, $route, $request, $method)
// router take care of calling these filters so we do not duplicate logics.
if ($this->filterApplies($filter, $request, $method))
{
- $route->after($filter['original']);
+ $route->after($this->getAssignableAfter($filter));
}
}
}
+ /**
+ * Get the assignable after filter for the route.
+ *
+ * @param Closure|string $filter
+ * @return string
+ */
+ protected function getAssignableAfter($filter)
+ {
+ return $filter['original'] instanceof Closure ? $filter['filter'] : $filter['original'];
+ }
+
/**
* Determine if the given filter applies to the request.
* | false |
Other | laravel | framework | 5d5091f2fca543104c5635953ab36bbbe84a4c72.json | Fix array syntax for PHP 5.3 | tests/View/ViewEnvironmentTest.php | @@ -173,7 +173,7 @@ public function testComposersCanBeMassRegistered()
$env->getDispatcher()->shouldReceive('listen')->once()->with('composing: foo', m::type('Closure'));
$composers = $env->composers(array(
'foo' => 'bar',
- 'baz@baz' => ['qux', 'foo'],
+ 'baz@baz' => array('qux', 'foo'),
));
$reflections = array( | false |
Other | laravel | framework | f6c1319283e3b31bc8ab8067393b436b003c2857.json | Make resolveProviderClass public | src/Illuminate/Foundation/Application.php | @@ -324,7 +324,7 @@ public function register($provider, $options = array())
* @param string $provider
* @return \Illuminate\Support\ServiceProvider
*/
- protected function resolveProviderClass($provider)
+ public function resolveProviderClass($provider)
{
return new $provider($this);
} | false |
Other | laravel | framework | f7894e9da7d92de64f2c73eedc78c3a7ed66a740.json | Return connect value. | src/Illuminate/Remote/SecLibGateway.php | @@ -78,11 +78,11 @@ protected function setHostAndPort($host)
* Connect to the SSH server.
*
* @param string $username
- * @return void
+ * @return bool
*/
public function connect($username)
{
- $this->getConnection()->login($username, $this->getAuthForLogin());
+ return $this->getConnection()->login($username, $this->getAuthForLogin());
}
/** | false |
Other | laravel | framework | f5399ea6490e5b3bfeae0ff6f4b11f001eb861e7.json | Throw exception if we can't connect. | src/Illuminate/Remote/Connection.php | @@ -64,7 +64,7 @@ class Connection implements ConnectionInterface {
* @param string $username
* @param array $auth
* @param \Illuminate\Remote\GatewayInterface
- * @param
+ * @param
*/
public function __construct($name, $host, $username, array $auth, GatewayInterface $gateway = null)
{
@@ -214,7 +214,10 @@ public function getGateway()
{
if ( ! $this->gateway->connected())
{
- $this->gateway->connect($this->username);
+ if ( ! $this->gateway->connect($this->username))
+ {
+ throw new \RuntimeException("Unable to connect to remote server.");
+ }
}
return $this->gateway; | false |
Other | laravel | framework | 3e49b6254b76895539d489c7a3645ec3d56e5c4d.json | Fix variable name. | src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php | @@ -244,7 +244,7 @@ public function addConstraints()
*/
public function getRelationCountQuery(Builder $query, Builder $parent)
{
- if ($original->getQuery()->from == $query->getQuery()->from)
+ if ($parent->getQuery()->from == $query->getQuery()->from)
{
return $this->getRelationCountQueryForSelfJoin($query, $parent);
} | false |
Other | laravel | framework | 636032616fd8a6af13f9186b6535dea96d244575.json | Remove unneeded method. | src/Illuminate/View/Engines/Engine.php | @@ -9,16 +9,6 @@ abstract class Engine {
*/
protected $lastRendered;
- /**
- * Determine if the engine is sectionable.
- *
- * @return bool
- */
- public function isSectionable()
- {
- return $this instanceof SectionableInterface;
- }
-
/**
* Get the last view that was rendered.
* | false |
Other | laravel | framework | f27fd58b42ef1b84215879aee21729e4202e4f3f.json | Remove unused Filesystem | src/Illuminate/Foundation/start.php | @@ -43,7 +43,6 @@
*/
use Illuminate\Http\Request;
-use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Facade;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Config\Repository as Config;
@@ -241,4 +240,4 @@
if (file_exists($routes)) require $routes;
-});
\ No newline at end of file
+}); | false |
Other | laravel | framework | 677a4345ffffb8ec3191753e2e0ed74a584553fa.json | Add database prefix to renameColumn
Fixes an issue where renameColumn throws an exception if a database prefix is set.
Signed-off-by: Suhayb El Wardany <me@suw.me> | src/Illuminate/Database/Schema/Grammars/Grammar.php | @@ -23,7 +23,9 @@ public function compileRenameColumn(Blueprint $blueprint, Fluent $command, Conne
{
$schema = $connection->getDoctrineSchemaManager();
- $column = $connection->getDoctrineColumn($blueprint->getTable(), $command->from);
+ $table = $this->getTablePrefix() . $blueprint->getTable();
+
+ $column = $connection->getDoctrineColumn($table, $command->from);
$tableDiff = $this->getRenamedDiff($blueprint, $command, $column, $schema);
@@ -255,11 +257,13 @@ protected function getDefaultValue($value)
*/
protected function getDoctrineTableDiff(Blueprint $blueprint, SchemaManager $schema)
{
- $tableDiff = new TableDiff($blueprint->getTable());
+ $table = $this->getTablePrefix() . $blueprint->getTable();
+
+ $tableDiff = new TableDiff($table);
- $tableDiff->fromTable = $schema->listTableDetails($blueprint->getTable());
+ $tableDiff->fromTable = $schema->listTableDetails($table);
return $tableDiff;
}
-}
\ No newline at end of file
+} | false |
Other | laravel | framework | 8d80cc42fa368364a40d201cd2aea3b6b9147a12.json | rename some classes for consistency. | src/Illuminate/Auth/Console/MakeRemindersCommand.php | @@ -3,7 +3,7 @@
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
-class MakeRemindersCommand extends Command {
+class RemindersTableCommand extends Command {
/**
* The console command name. | true |
Other | laravel | framework | 8d80cc42fa368364a40d201cd2aea3b6b9147a12.json | rename some classes for consistency. | src/Illuminate/Auth/Reminders/ReminderServiceProvider.php | @@ -1,7 +1,7 @@
<?php namespace Illuminate\Auth\Reminders;
use Illuminate\Support\ServiceProvider;
-use Illuminate\Auth\Console\MakeRemindersCommand;
+use Illuminate\Auth\Console\RemindersTableCommand;
use Illuminate\Auth\Console\ClearRemindersCommand;
use Illuminate\Auth\Console\RemindersControllerCommand;
use Illuminate\Auth\Reminders\DatabaseReminderRepository as DbRepository;
@@ -91,7 +91,7 @@ protected function registerCommands()
{
$this->app->bindShared('command.auth.reminders', function($app)
{
- return new MakeRemindersCommand($app['files']);
+ return new RemindersTableCommand($app['files']);
});
$this->app->bindShared('command.auth.reminders.clear', function($app) | true |
Other | laravel | framework | 8d80cc42fa368364a40d201cd2aea3b6b9147a12.json | rename some classes for consistency. | src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php | @@ -4,7 +4,7 @@
use Symfony\Component\Console\Input\InputArgument;
use Illuminate\Database\Migrations\MigrationCreator;
-class MakeCommand extends BaseCommand {
+class MigrateMakeCommand extends BaseCommand {
/**
* The console command name.
@@ -64,7 +64,7 @@ public function fire()
$table = $this->input->getOption('table');
$create = $this->input->getOption('create');
-
+
if ( ! $table && is_string($create))
{
$table = $create; | true |
Other | laravel | framework | 8d80cc42fa368364a40d201cd2aea3b6b9147a12.json | rename some classes for consistency. | src/Illuminate/Database/MigrationServiceProvider.php | @@ -3,12 +3,12 @@
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Migrations\Migrator;
use Illuminate\Database\Migrations\MigrationCreator;
-use Illuminate\Database\Console\Migrations\MakeCommand;
use Illuminate\Database\Console\Migrations\ResetCommand;
use Illuminate\Database\Console\Migrations\RefreshCommand;
use Illuminate\Database\Console\Migrations\InstallCommand;
use Illuminate\Database\Console\Migrations\MigrateCommand;
use Illuminate\Database\Console\Migrations\RollbackCommand;
+use Illuminate\Database\Console\Migrations\MigrateMakeCommand;
use Illuminate\Database\Migrations\DatabaseMigrationRepository;
class MigrationServiceProvider extends ServiceProvider {
@@ -185,7 +185,7 @@ protected function registerMakeCommand()
$packagePath = $app['path.base'].'/vendor';
- return new MakeCommand($creator, $packagePath);
+ return new MigrateMakeCommand($creator, $packagePath);
});
}
| true |
Other | laravel | framework | 8d80cc42fa368364a40d201cd2aea3b6b9147a12.json | rename some classes for consistency. | src/Illuminate/Session/CommandsServiceProvider.php | @@ -20,7 +20,7 @@ public function register()
{
$this->app->bindShared('command.session.database', function($app)
{
- return new Console\MakeTableCommand($app['files']);
+ return new Console\SessionTableCommand($app['files']);
});
$this->commands('command.session.database'); | true |
Other | laravel | framework | 8d80cc42fa368364a40d201cd2aea3b6b9147a12.json | rename some classes for consistency. | src/Illuminate/Session/Console/SessionTableCommand.php | @@ -3,7 +3,7 @@
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
-class MakeTableCommand extends Command {
+class SessionTableCommand extends Command {
/**
* The console command name. | true |
Other | laravel | framework | 8d80cc42fa368364a40d201cd2aea3b6b9147a12.json | rename some classes for consistency. | tests/Database/DatabaseMigrationMakeCommandTest.php | @@ -1,7 +1,7 @@
<?php
use Mockery as m;
-use Illuminate\Database\Console\Migrations\MakeCommand;
+use Illuminate\Database\Console\Migrations\MigrateMakeCommand;
class DatabaseMigrationMakeCommandTest extends PHPUnit_Framework_TestCase {
@@ -62,7 +62,7 @@ protected function runCommand($command, $input = array())
-class DatabaseMigrationMakeCommandTestStub extends MakeCommand
+class DatabaseMigrationMakeCommandTestStub extends MigrateMakeCommand
{
public function call($command, array $arguments = array())
{ | true |
Other | laravel | framework | 15489ab9d8fb3287271c9f85ecf0c59886e11f38.json | Fix eloquent model relation doc blocks | src/Illuminate/Database/Eloquent/Model.php | @@ -637,7 +637,7 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat
}
/**
- * Define an polymorphic, inverse one-to-one or many relationship.
+ * Define a polymorphic, inverse one-to-one or many relationship.
*
* @param string $name
* @param string $type
@@ -779,7 +779,7 @@ public function belongsToMany($related, $table = null, $foreignKey = null, $othe
}
/**
- * Define a many-to-many relationship.
+ * Define a polymorphic many-to-many relationship.
*
* @param string $related
* @param string $name
@@ -816,7 +816,7 @@ public function morphToMany($related, $name, $table = null, $foreignKey = null,
}
/**
- * Define a many-to-many relationship.
+ * Define a polymorphic many-to-many relationship.
*
* @param string $related
* @param string $name | false |
Other | laravel | framework | ebaf26c71b44f1f7650ba79d55cae0a64f029e7f.json | Add format parameter to Form::selectMonth | src/Illuminate/Html/FormBuilder.php | @@ -470,15 +470,16 @@ public function selectYear()
* @param string $name
* @param string $selected
* @param array $options
+ * @param string $format
* @return string
*/
- public function selectMonth($name, $selected = null, $options = array())
+ public function selectMonth($name, $selected = null, $options = array(), $format = '%B')
{
$months = array();
foreach (range(1, 12) as $month)
{
- $months[$month] = strftime('%B', mktime(0, 0, 0, $month, 1));
+ $months[$month] = strftime($format, mktime(0, 0, 0, $month, 1));
}
return $this->select($name, $months, $selected, $options); | false |
Other | laravel | framework | 47f906120c578cec83d44744803e670acc57a2a7.json | Add setModel method to FormBuilder | src/Illuminate/Html/FormBuilder.php | @@ -150,6 +150,17 @@ public function model($model, array $options = array())
return $this->open($options);
}
+ /**
+ * Set model on form builder.
+ *
+ * @param mixed $model
+ * @return void
+ */
+ public function setModel($model)
+ {
+ $this->model = $model;
+ }
+
/**
* Close the current form.
* | false |
Other | laravel | framework | e21766c81d30bbe06c4860b7f6ff9a055abb27a0.json | Allow whereHas on belongsTo relations. | src/Illuminate/Database/Eloquent/Relations/BelongsTo.php | @@ -3,6 +3,7 @@
use LogicException;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Database\Query\Expression;
use Illuminate\Database\Eloquent\Collection;
class BelongsTo extends Relation {
@@ -85,7 +86,11 @@ public function addConstraints()
*/
public function getRelationCountQuery(Builder $query)
{
- throw new LogicException('Has method invalid on "belongsTo" relations.');
+ $query->select(new Expression('count(*)'));
+
+ $otherKey = $this->wrap($query->getModel()->getTable().'.'.$this->otherKey);
+
+ return $query->where($this->getQualifiedForeignKey(), '=', new Expression($otherKey));
}
/**
@@ -227,4 +232,14 @@ public function getForeignKey()
return $this->foreignKey;
}
+ /**
+ * Get the fully qualified foreign key of the relationship.
+ *
+ * @return string
+ */
+ public function getQualifiedForeignKey()
+ {
+ return $this->parent->getTable().'.'.$this->foreignKey;
+ }
+
}
\ No newline at end of file | false |
Other | laravel | framework | 736716781cc1856ebb12701fc95edebaa894d716.json | return boolean from Filesystem::delete. | src/Illuminate/Filesystem/Filesystem.php | @@ -93,7 +93,7 @@ public function prepend($path, $data)
{
if ($this->exists($path))
{
- return $this->put($path, $data.$this->get($path));
+ return $this->put($path, $data.$this->get($path));
}
else
{
@@ -123,7 +123,11 @@ public function delete($paths)
{
$paths = is_array($paths) ? $paths : func_get_args();
- foreach ($paths as $path) { @unlink($path); }
+ $success = true;
+
+ foreach ($paths as $path) { if ( ! @unlink($path)) $success = false; }
+
+ return $success;
}
/**
@@ -395,7 +399,7 @@ public function deleteDirectory($directory, $preserve = false)
}
if ( ! $preserve) @rmdir($directory);
-
+
return true;
}
| false |
Other | laravel | framework | b31117aaef08f8432606acdc03dd09813643b63f.json | Fix the definite article on evaluated | src/Illuminate/View/Environment.php | @@ -103,7 +103,7 @@ public function __construct(EngineResolver $engines, ViewFinderInterface $finder
}
/**
- * Get a evaluated view contents for the given view.
+ * Get the evaluated view contents for the given view.
*
* @param string $view
* @param array $data
@@ -133,7 +133,7 @@ protected function parseData($data)
}
/**
- * Get a evaluated view contents for a named view.
+ * Get the evaluated view contents for a named view.
*
* @param string $view
* @param mixed $data | false |
Other | laravel | framework | 9f53166d5645596f94820511b4ea39bce8be9f53.json | Fix the enum indefinite article | src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php | @@ -427,7 +427,7 @@ protected function typeBoolean(Fluent $column)
}
/**
- * Create the column definition for a enum type.
+ * Create the column definition for an enum type.
*
* @param \Illuminate\Support\Fluent $column
* @return string | true |
Other | laravel | framework | 9f53166d5645596f94820511b4ea39bce8be9f53.json | Fix the enum indefinite article | src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php | @@ -437,7 +437,7 @@ protected function typeBoolean(Fluent $column)
}
/**
- * Create the column definition for a enum type.
+ * Create the column definition for an enum type.
*
* @param \Illuminate\Support\Fluent $column
* @return string | true |
Other | laravel | framework | 9f53166d5645596f94820511b4ea39bce8be9f53.json | Fix the enum indefinite article | src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php | @@ -371,7 +371,7 @@ protected function typeBoolean(Fluent $column)
}
/**
- * Create the column definition for a enum type.
+ * Create the column definition for an enum type.
*
* @param \Illuminate\Support\Fluent $column
* @return string | true |
Other | laravel | framework | 612d58d4533690bb2801287879cb2dfb532ab820.json | Specify query cache driver | src/Illuminate/Database/Query/Builder.php | @@ -148,6 +148,13 @@ class Builder {
*/
protected $cacheTags;
+ /**
+ * The driver for the query cache.
+ *
+ * @var string
+ */
+ protected $cacheDriver;
+
/**
* All of the available clause operators.
*
@@ -1112,6 +1119,19 @@ public function cacheTags($cacheTags)
return $this;
}
+ /**
+ * Indicate that the results, if cached, should use the given cache driver.
+ *
+ * @param string $cacheDriver
+ * @return \Illuminate\Database\Query\Builder|static
+ */
+ public function cacheDriver($cacheDriver)
+ {
+ $this->cacheDriver = $cacheDriver;
+
+ return $this;
+ }
+
/**
* Execute a query for a single record by ID.
*
@@ -1225,7 +1245,7 @@ public function getCached($columns = array('*'))
*/
protected function getCache()
{
- $cache = $this->connection->getCacheManager();
+ $cache = $this->connection->getCacheManager()->driver($this->cacheDriver);
return $this->cacheTags ? $cache->tags($this->cacheTags) : $cache;
} | false |
Other | laravel | framework | 0a90a98eab970271d7b49b535b13af5284300793.json | Fix Router.php to behave on App::error
When App::error is triggered, Route is empty. When you try to access Route::currentRouteNamed($string), it fails because Route::current() is empty and does not have a getName() method. | src/Illuminate/Routing/Router.php | @@ -1407,7 +1407,7 @@ public function current()
*/
public function currentRouteName()
{
- return $this->current()->getName();
+ return ($this->current()) ? $this->current()->getName() : null;
}
/**
@@ -1418,7 +1418,7 @@ public function currentRouteName()
*/
public function currentRouteNamed($name)
{
- return $this->current()->getName() == $name;
+ return ($this->current()) ? $this->current()->getName() == $name : false;
}
/** | false |
Other | laravel | framework | 9933484ca2ba7638007be888654538b65fd21a20.json | Fix docblock for return values | src/Illuminate/Routing/Router.php | @@ -115,7 +115,6 @@ class Router implements HttpKernelInterface, RouteFiltererInterface {
*
* @param \Illuminate\Events\Dispatcher $events
* @param \Illuminate\Container\Container $container
- * @return void
*/
public function __construct(Dispatcher $events, Container $container = null)
{
@@ -356,12 +355,12 @@ protected function prefixedResource($name, $controller, array $options)
// We need to extract the base resource from the resource name. Nested resources
// are supported in the framework, but we need to know what name to use for a
// place-holder on the route wildcards, which should be the base resources.
- $callback = function($me) use ($name, $controller, $options)
+ $callback = function(Router $me) use ($name, $controller, $options)
{
$me->resource($name, $controller, $options);
};
- return $this->group(compact('prefix'), $callback);
+ $this->group(compact('prefix'), $callback);
}
/**
@@ -508,7 +507,7 @@ public function getResourceWildcard($value)
* @param string $base
* @param string $controller
* @param array $options
- * @return void
+ * @return Route
*/
protected function addResourceIndex($name, $base, $controller, $options)
{
@@ -524,7 +523,7 @@ protected function addResourceIndex($name, $base, $controller, $options)
* @param string $base
* @param string $controller
* @param array $options
- * @return void
+ * @return Route
*/
protected function addResourceCreate($name, $base, $controller, $options)
{
@@ -540,7 +539,7 @@ protected function addResourceCreate($name, $base, $controller, $options)
* @param string $base
* @param string $controller
* @param array $options
- * @return void
+ * @return Route
*/
protected function addResourceStore($name, $base, $controller, $options)
{
@@ -556,7 +555,7 @@ protected function addResourceStore($name, $base, $controller, $options)
* @param string $base
* @param string $controller
* @param array $options
- * @return void
+ * @return Route
*/
protected function addResourceShow($name, $base, $controller, $options)
{
@@ -572,7 +571,7 @@ protected function addResourceShow($name, $base, $controller, $options)
* @param string $base
* @param string $controller
* @param array $options
- * @return void
+ * @return Route
*/
protected function addResourceEdit($name, $base, $controller, $options)
{
@@ -594,7 +593,7 @@ protected function addResourceUpdate($name, $base, $controller, $options)
{
$this->addPutResourceUpdate($name, $base, $controller, $options);
- return $this->addPatchResourceUpdate($name, $base, $controller);
+ $this->addPatchResourceUpdate($name, $base, $controller);
}
/**
@@ -604,7 +603,7 @@ protected function addResourceUpdate($name, $base, $controller, $options)
* @param string $base
* @param string $controller
* @param array $options
- * @return void
+ * @return Route
*/
protected function addPutResourceUpdate($name, $base, $controller, $options)
{
@@ -635,7 +634,7 @@ protected function addPatchResourceUpdate($name, $base, $controller)
* @param string $base
* @param string $controller
* @param array $options
- * @return void
+ * @return Route
*/
protected function addResourceDestroy($name, $base, $controller, $options)
{
@@ -849,7 +848,7 @@ protected function routingToController($action)
* Add a controller based route action to the action array.
*
* @param array|string $action
- * @return void
+ * @return array
*/
protected function getControllerAction($action)
{
@@ -1047,7 +1046,7 @@ public function after($callback)
* Register a new global filter with the router.
*
* @param string $filter
- * @param mxied $callback
+ * @param mixed $callback
* @return void
*/
protected function addGlobalFilter($filter, $callback)
@@ -1111,7 +1110,7 @@ public function when($pattern, $name, $methods = null)
*/
public function model($key, $class, Closure $callback = null)
{
- return $this->bind($key, function($value) use ($class, $callback)
+ $this->bind($key, function($value) use ($class, $callback)
{
if (is_null($value)) return null;
| false |
Other | laravel | framework | 79b69790ff4415221c96d8df0f41282cadd18009.json | Use max() instead of ternary in DB offset. | src/Illuminate/Database/Query/Builder.php | @@ -947,7 +947,7 @@ public function orderByRaw($sql, $bindings = array())
*/
public function offset($value)
{
- $this->offset = $value > 0 ? $value : 0;
+ $this->offset = max(0, $value);
return $this;
} | false |
Other | laravel | framework | d6e9c601054595ac5c1b40e426f22c97d50bd508.json | Fix missing method. | src/Illuminate/Routing/Controller.php | @@ -205,15 +205,14 @@ public function callAction($method, $parameters)
/**
* Handle calls to missing methods on the controller.
*
- * @param string $method
* @param array $parameters
* @return mixed
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
- public function missingMethod($method, $parameters = array())
+ public function missingMethod($parameters = array())
{
- throw new NotFoundHttpException("Controller method [{$method}] not found.");
+ throw new NotFoundHttpException("Controller method not found.");
}
/**
@@ -225,7 +224,7 @@ public function missingMethod($method, $parameters = array())
*/
public function __call($method, $parameters)
{
- return $this->missingMethod($method, $parameters);
+ throw new \BadMethodCallException("Method [$method] does not exist.");
}
} | true |
Other | laravel | framework | d6e9c601054595ac5c1b40e426f22c97d50bd508.json | Fix missing method. | src/Illuminate/Routing/Router.php | @@ -122,6 +122,8 @@ public function __construct(Dispatcher $events, Container $container = null)
$this->events = $events;
$this->routes = new RouteCollection;
$this->container = $container ?: new Container;
+
+ $this->bind('_missing', function($v) { return explode('/', $v); });
}
/** | true |
Other | laravel | framework | 516f0151bda428b62edb52d2206896bb1d087700.json | Fix bugs and merge. | composer.json | @@ -32,6 +32,7 @@
"symfony/http-foundation": "2.4.*",
"symfony/http-kernel": "2.4.*",
"symfony/process": "2.4.*",
+ "symfony/routing": "2.4.*",
"symfony/translation": "2.4.*"
},
"replace": {
| true |
Other | laravel | framework | 516f0151bda428b62edb52d2206896bb1d087700.json | Fix bugs and merge. | src/Illuminate/Routing/Matching/HostValidator.php | @@ -14,9 +14,9 @@ class HostValidator implements ValidatorInterface {
*/
public function matches(Route $route, Request $request)
{
- if (is_null($route->hostExpression())) return true;
+ if (is_null($route->getCompiled()->getHostRegex())) return true;
- return preg_match($route->hostExpression(), $request->getHost());
+ return preg_match($route->getCompiled()->getHostRegex(), $request->getHost());
}
}
\ No newline at end of file | true |
Other | laravel | framework | 516f0151bda428b62edb52d2206896bb1d087700.json | Fix bugs and merge. | src/Illuminate/Routing/Matching/UriValidator.php | @@ -14,7 +14,9 @@ class UriValidator implements ValidatorInterface {
*/
public function matches(Route $route, Request $request)
{
- return preg_match($route->uriExpression(), $request->path());
+ $path = $request->path() == '/' ? '/' : '/'.$request->path();
+
+ return preg_match($route->getCompiled()->getRegex(), $path);
}
}
\ No newline at end of file | true |
Other | laravel | framework | 516f0151bda428b62edb52d2206896bb1d087700.json | Fix bugs and merge. | src/Illuminate/Routing/Route.php | @@ -6,6 +6,7 @@
use Illuminate\Routing\Matching\HostValidator;
use Illuminate\Routing\Matching\MethodValidator;
use Illuminate\Routing\Matching\SchemeValidator;
+use Symfony\Component\Routing\Route as SymfonyRoute;
class Route {
@@ -59,25 +60,11 @@ class Route {
protected $parameterNames;
/**
- * The regular expression for a wildcard.
+ * The compiled version of the route.
*
- * @var string
- */
- protected static $wildcard = '(?P<$1>([a-zA-Z0-9\.\,\-_%=+]+))';
-
- /**
- * The regular expression for an optional wildcard.
- *
- * @var string
- */
- protected static $optional = '(?:/(?P<$1>([a-zA-Z0-9\.\,\-_%=+]+))';
-
- /**
- * The regular expression for a leading optional wildcard.
- *
- * @var string
+ * @var \Symfony\Component\Routing\CompiledRoute
*/
- protected static $leadingOptional = '(\/$|^(?:(?P<$2>([a-zA-Z0-9\.\,\-_%=+]+)))';
+ protected $compiled;
/**
* The validators used by the routes.
@@ -126,6 +113,8 @@ public function run()
*/
public function matches(Request $request)
{
+ $this->compileRoute();
+
foreach ($this->getValidators() as $validator)
{
if ( ! $validator->matches($this, $request)) return false;
@@ -134,6 +123,43 @@ public function matches(Request $request)
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);
+
+ $optional = array();
+
+ if (isset($matches[1]))
+ {
+ foreach ($matches[1] as $key) { $optional[$key] = null; }
+ }
+
+ return $optional;
+ }
+
/**
* Get the "before" filters for the route.
*
@@ -264,7 +290,14 @@ public function setParameter($name, $value)
*/
public function parameters()
{
- if (isset($this->parameters)) return array_map('urldecode', $this->parameters);
+ if (isset($this->parameters))
+ {
+ return array_map(function($value)
+ {
+ return is_string($value) ? urldecode($value) : $value;
+
+ }, $this->parameters);
+ }
throw new \LogicException("Route is not bound.");
}
@@ -276,7 +309,7 @@ public function parameters()
*/
public function parametersWithoutNulls()
{
- return array_filter($this->parameters(), function($p) { return ! is_null($p); });
+ return array_filter($this->parameters(), function($p) { return ! is_null($p); });
}
/**
@@ -311,6 +344,8 @@ protected function compileParameterNames()
*/
public function bind(Request $request)
{
+ $this->compileRoute();
+
$this->bindParameters($request);
return $this;
@@ -324,10 +359,17 @@ public function bind(Request $request)
*/
public function bindParameters(Request $request)
{
- preg_match($this->fullMatchExpression(), $this->fullMatchPath($request), $matches);
+ preg_match($this->compiled->getRegex(), '/'.$request->path(), $matches);
$parameters = $this->combineMatchesWithKeys(array_slice($matches, 1));
+ if ( ! is_null($this->compiled->getHostRegex()))
+ {
+ preg_match($this->compiled->getHostRegex(), $request->getHost(), $matches);
+
+ $parameters = array_merge($parameters, $this->combineMatchesWithKeys(array_slice($matches, 1)));
+ }
+
return $this->parameters = $this->replaceDefaults($parameters);
}
@@ -376,174 +418,6 @@ protected function replaceDefaults(array $parameters)
return $parameters;
}
- /**
- * Get the full match expression for the route.
- *
- * @return string
- */
- protected function fullMatchExpression()
- {
- $value = trim($this->hostExpression(false).'/'.$this->uriExpression(false), '/');
-
- return $this->delimit($value ?: '/');
- }
-
- /**
- * Get the full match path for the request.
- *
- * @param \Illuminate\Http\Request $request
- * @return string
- */
- protected function fullMatchPath($request)
- {
- if (isset($this->action['domain']))
- {
- return trim($request->getHost().'/'.$request->path(), '/');
- }
- else
- {
- return $request->path();
- }
- }
-
- /**
- * Get the regular expression for the host.
- *
- * @param bool $delimit
- * @return string|null
- */
- public function hostExpression($delimit = true)
- {
- if ( ! isset($this->action['domain'])) return;
-
- return $this->compileString($this->action['domain'], $delimit, $this->wheres);
- }
-
- /**
- * Get the regular expression for the URI.
- *
- * @param bool $delimit
- * @return string|null
- */
- public function uriExpression($delimit = true)
- {
- return $this->compileString($this->uri, $delimit, $this->wheres);
- }
-
- /**
- * Compile the given route string as a regular expression.
- *
- * @param string $value
- * @param bool $delimit
- * @param array $wheres
- * @return string
- */
- public static function compileString($value, $delimit = true, array $wheres = array())
- {
- $value = static::compileOptional(static::compileParameters($value, $wheres), $wheres);
-
- return $delimit ? static::delimit($value) : $value;
- }
-
- /**
- * Compile the wildcards for a given string.
- *
- * @param string $value
- * @param array $wheres
- * @return string
- */
- protected static function compileParameters($value, array $wheres = array())
- {
- $value = static::compileWhereParameters($value, $wheres);
-
- return preg_replace('/\{([A-Za-z\-\_]+)\}/', static::$wildcard, $value);
- }
-
- /**
- * Compile the defined "where" parameters.
- *
- * @param string $value
- * @param array $wheres
- * @return string
- */
- protected static function compileWhereParameters($value, array $wheres)
- {
- foreach ($wheres as $key => $pattern)
- {
- $value = str_replace('{'.$key.'}', '(?P<'.$key.'>('.$pattern.'))', $value);
- }
-
- return $value;
- }
-
- /**
- * Compile the optional wildcards for a given string.
- *
- * @param string $value
- * @param array $wheres
- * @return string
- */
- protected static function compileOptional($value, $wheres = array())
- {
- list($value, $custom) = static::compileWhereOptional($value, $wheres);
-
- return static::compileStandardOptional($value, $custom);
- }
-
- /**
- * Compile the standard optional wildcards for a given string.
- *
- * @param string $value
- * @param int $custom
- * @return string
- */
- protected static function compileStandardOptional($value, $custom = 0)
- {
- $value = preg_replace('/\/\{([A-Za-z\-\_]+)\?\}/', static::$optional, $value, -1, $count);
-
- $value = preg_replace('/^(\{([A-Za-z\-\_]+)\?\})/', static::$leadingOptional, $value, -1, $leading);
-
- $total = $leading + $count + $custom;
-
- return $total > 0 ? $value .= str_repeat(')?', $total) : $value;
- }
-
- /**
- * Compile the defined optional "where" parameters.
- *
- * @param string $value
- * @param array $wheres
- * @param int $total
- * @return string
- */
- protected static function compileWhereOptional($value, $wheres, $total = 0)
- {
- foreach ($wheres as $key => $pattern)
- {
- $pattern = "(?:/(?P<{$key}>({$pattern}))";
-
- // Here we will need to replace the optional parameters while keeping track of the
- // count we are replacing. This will let us properly close this finished regular
- // expressions with the proper number of parenthesis so that it is valid code.
- $value = str_replace('/{'.$key.'?}', $pattern, $value, $count);
-
- $total = $total + $count;
- }
-
- return array($value, $total);
- }
-
- /**
- * Delimit a regular expression.
- *
- * @param string $value
- * @return string
- */
- protected static function delimit($value)
- {
- return trim($value) == '' ? null : '#^'.$value.'$#u';
- }
-
/**
* Parse the route action into a standard array.
*
@@ -811,4 +685,14 @@ public function setAction(array $action)
return $this;
}
+ /**
+ * Get the compiled version of the route.
+ *
+ * @return void
+ */
+ public function getCompiled()
+ {
+ return $this->compiled;
+ }
+
}
| true |
Other | laravel | framework | 516f0151bda428b62edb52d2206896bb1d087700.json | Fix bugs and merge. | src/Illuminate/Routing/Router.php | @@ -1398,6 +1398,16 @@ public function current()
return $this->current;
}
+ /**
+ * Get the current route name.
+ *
+ * @return string|null
+ */
+ public function currentRouteName()
+ {
+ return $this->current()->getName();
+ }
+
/**
* Determine if the current route matches a given name.
* | true |
Other | laravel | framework | 516f0151bda428b62edb52d2206896bb1d087700.json | Fix bugs and merge. | tests/Routing/RoutingRouteTest.php | @@ -67,6 +67,24 @@ public function testBasicDispatchingOfRoutes()
}
+ public function testNonGreedyMatches()
+ {
+ $route = new Route('GET', 'images/{id}.{ext}', function() {});
+
+ $request1 = Request::create('images/1.png', 'GET');
+ $this->assertTrue($route->matches($request1));
+ $route->bind($request1);
+ $this->assertEquals('1', $route->parameter('id'));
+ $this->assertEquals('png', $route->parameter('ext'));
+
+ $request2 = Request::create('images/12.png', 'GET');
+ $this->assertTrue($route->matches($request2));
+ $route->bind($request2);
+ $this->assertEquals('12', $route->parameter('id'));
+ $this->assertEquals('png', $route->parameter('ext'));
+ }
+
+
/**
* @expectedException Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
@@ -344,6 +362,25 @@ public function testWherePatternsProperlyFilter()
}
+ public function testDotDoesNotMatchEverything()
+ {
+ $route = new Route('GET', 'images/{id}.{ext}', function() {});
+
+ $request1 = Request::create('images/1.png', 'GET');
+ $this->assertTrue($route->matches($request1));
+ $route->bind($request1);
+ $this->assertEquals('1', $route->parameter('id'));
+ $this->assertEquals('png', $route->parameter('ext'));
+
+ $request2 = Request::create('images/12.png', 'GET');
+ $this->assertTrue($route->matches($request2));
+ $route->bind($request2);
+ $this->assertEquals('12', $route->parameter('id'));
+ $this->assertEquals('png', $route->parameter('ext'));
+
+ }
+
+
public function testRouteBinding()
{
$router = $this->getRouter();
@@ -383,34 +420,6 @@ public function testModelBindingWithCustomNullReturn()
}
- public function testRouteCompilationAgainstHosts()
- {
- $this->assertEquals(1, preg_match(Route::compileString('{foo}.website.{baz}'), 'baz.website.com'));
- }
-
-
- public function testRouteCompilationAgainstUris()
- {
- $this->assertEquals(1, preg_match(Route::compileString('{foo}'), 'foo'));
- $this->assertEquals(1, preg_match(Route::compileString('foo/{bar}'), 'foo/bar'));
- $this->assertEquals(1, preg_match(Route::compileString('foo/{bar}/baz/{boom}'), 'foo/bar/baz/boom'));
- $this->assertEquals(1, preg_match(Route::compileString('foo/{bar}/{baz}'), 'foo/bar/baz'));
-
- $this->assertEquals(0, preg_match(Route::compileString('{foo}'), 'foo/bar'));
- $this->assertEquals(0, preg_match(Route::compileString('foo/{bar}'), 'foo/'));
- $this->assertEquals(0, preg_match(Route::compileString('foo/{bar}/baz/{boom}'), 'foo/baz/boom'));
- $this->assertEquals(0, preg_match(Route::compileString('foo/{bar}/{baz}'), 'foo/bar/baz/brick'));
-
- $this->assertEquals(1, preg_match(Route::compileString('foo/{baz?}'), 'foo/bar'));
- $this->assertEquals(1, preg_match(Route::compileString('foo/{bar}/{baz?}'), 'foo/bar'));
- $this->assertEquals(1, preg_match(Route::compileString('foo/{bar}/{baz?}'), 'foo/bar/baz'));
-
- $this->assertEquals(0, preg_match(Route::compileString('foo/{baz?}'), 'foo/bar/baz'));
- $this->assertEquals(0, preg_match(Route::compileString('foo/{bar}/{baz?}'), 'foo'));
- $this->assertEquals(0, preg_match(Route::compileString('foo/{bar}/{baz?}'), 'foo/bar/baz/boom'));
- }
-
-
public function testGroupMerging()
{
$old = array('prefix' => 'foo/bar/');
| true |
Other | laravel | framework | a911fac3e54a8e8242f5c0fa5e411247c3004e27.json | Use non-greedy quantifier for wildcard regex. | src/Illuminate/Routing/Route.php | @@ -63,7 +63,7 @@ class Route {
*
* @var string
*/
- protected static $wildcard = '(?P<$1>([a-zA-Z0-9\.\,\-_%=+]+))';
+ protected static $wildcard = '(?P<$1>([a-zA-Z0-9\.\,\-_%=+]+?))';
/**
* The regular expression for an optional wildcard.
| false |
Other | laravel | framework | eaa6de136963100b93a223ff45c9631aa7496d0e.json | Bind request to route. | tests/Routing/RoutingRouteTest.php | @@ -350,11 +350,13 @@ public function testDotDoesNotMatchEverything()
$request1 = Request::create('images/1.png', 'GET');
$this->assertTrue($route->matches($request1));
+ $route->bind($request1);
$this->assertEquals('1', $route->parameter('id'));
$this->assertEquals('png', $route->parameter('ext'));
$request2 = Request::create('images/12.png', 'GET');
$this->assertTrue($route->matches($request2));
+ $route->bind($request2);
$this->assertEquals('12', $route->parameter('id'));
$this->assertEquals('png', $route->parameter('ext'));
| false |
Other | laravel | framework | e350e7397d0518aa2a0cdd152332a31f18ba565e.json | Take array keys of pattern filters. | src/Illuminate/Foundation/Console/RoutesCommand.php | @@ -166,7 +166,7 @@ protected function getPatternFilters($route)
// we have already gathered up then return them back out to these consumers.
$inner = $this->getMethodPatterns($route->uri(), $method);
- $patterns = array_merge($patterns, $inner);
+ $patterns = array_merge($patterns, array_keys($inner));
}
return $patterns; | false |
Other | laravel | framework | 87ee594cd3a164491aea13e209762b4a10c308a6.json | Fix bug in router. | src/Illuminate/Routing/Route.php | @@ -456,7 +456,7 @@ protected static function compileParameters($value, array $wheres = array())
{
$value = static::compileWhereParameters($value, $wheres);
- return preg_replace('/\{([\w\-]+)\}/', static::$wildcard, $value);
+ return preg_replace('/\{([A-Za-z\-\_]+)\}/', static::$wildcard, $value);
}
/**
@@ -499,9 +499,9 @@ protected static function compileOptional($value, $wheres = array())
*/
protected static function compileStandardOptional($value, $custom = 0)
{
- $value = preg_replace('/\/\{([\w\-]+)\?\}/', static::$optional, $value, -1, $count);
+ $value = preg_replace('/\/\{([A-Za-z\-\_]+)\?\}/', static::$optional, $value, -1, $count);
- $value = preg_replace('/^(\{([\w\-]+)\?\})/', static::$leadingOptional, $value, -1, $leading);
+ $value = preg_replace('/^(\{([A-Za-z\-\_]+)\?\})/', static::$leadingOptional, $value, -1, $leading);
$total = $leading + $count + $custom;
| false |
Other | laravel | framework | 0012f28f88f19037fbea71a60c162d69903ceea7.json | Fix bug in URL generation. | src/Illuminate/Routing/UrlGenerator.php | @@ -221,7 +221,9 @@ protected function replaceRouteParameters($path, array $parameters)
$path = $this->replaceRouteParameter($path, $key, $value, $parameters);
}
- return $path.$this->getRouteQueryString($parameters);
+ $path = preg_replace('/\{.*?\?\}/', '', $path);
+
+ return trim($path, '/').$this->getRouteQueryString($parameters);
}
/**
| true |
Other | laravel | framework | 0012f28f88f19037fbea71a60c162d69903ceea7.json | Fix bug in URL generation. | tests/Routing/RoutingUrlGeneratorTest.php | @@ -116,7 +116,7 @@ public function testRoutesWithDomains()
public function testRoutesWithDomainsAndPorts()
{
- $url = new UrlGenerator(
+ $url = new UrlGenerator(
$routes = new Illuminate\Routing\RouteCollection,
$request = Illuminate\Http\Request::create('http://www.foo.com:8080/')
);
@@ -134,4 +134,18 @@ public function testRoutesWithDomainsAndPorts()
$this->assertEquals('http://sub.taylor.com:8080/foo/bar/otwell', $url->route('bar', array('taylor', 'otwell')));
}
+
+ public function testUrlGenerationForControllers()
+ {
+ $url = new UrlGenerator(
+ $routes = new Illuminate\Routing\RouteCollection,
+ $request = Illuminate\Http\Request::create('http://www.foo.com:8080/')
+ );
+
+ $route = new Illuminate\Routing\Route(array('GET'), 'foo/{one}/{two?}/{three?}', array('as' => 'foo', function() {}));
+ $routes->add($route);
+
+ $this->assertEquals('http://www.foo.com:8080/foo', $url->route('foo'));
+ }
+
}
\ No newline at end of file | true |
Other | laravel | framework | 35c3ed94d54f19b2e040da11a6687dac3cd9e9e9.json | Fix branch alias. | composer.json | @@ -83,7 +83,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "4.1-dev"
+ "dev-master": "4.2-dev"
}
},
"suggest": {
| false |
Other | laravel | framework | 7b7df5a18c38bd2bc24b1721d06e21dff11a418e.json | Add array_where helper. | src/Illuminate/Support/helpers.php | @@ -416,6 +416,28 @@ function array_sort($array, Closure $callback)
}
}
+if ( ! function_exists('array_where'))
+{
+ /**
+ * Filter the array using the given Closure.
+ *
+ * @param array $array
+ * @param \Closure $callback
+ * @return array
+ */
+ function array_where($array, Closure $callback)
+ {
+ $filtered = array();
+
+ foreach ($array as $key => $value)
+ {
+ if (call_user_func($callback, $key, $value)) $filtered[$key] = $value;
+ }
+
+ return $filtered;
+ }
+}
+
if ( ! function_exists('asset'))
{
/** | false |
Other | laravel | framework | 59fca940a3e59d91461e3b4d5dbe809146f38e72.json | Fix bug in URL generation. | src/Illuminate/Routing/UrlGenerator.php | @@ -193,18 +193,100 @@ public function route($name, $parameters = array(), $route = null)
* Get the URL for a given route instance.
*
* @param \Illuminate\Routing\Route $route
- * @param mixed $parameters
+ * @param array $parameters
* @return string
*/
- protected function toRoute($route, $parameters)
+ protected function toRoute($route, array $parameters)
{
$domain = $this->getRouteDomain($route, $parameters);
- $path = preg_replace_sub('/\{.*?\}/', $parameters, $route->uri());
+ return $this->replaceRouteParameters(
+
+ $this->trimUrl($this->getRouteRoot($route, $domain), $route->uri()), $parameters
+
+ );
+ }
+
+ /**
+ * Replace all of the wildcard parameters for a route path.
+ *
+ * @param string $path
+ * @param array $parameters
+ * @return string
+ */
+ protected function replaceRouteParameters($path, array $parameters)
+ {
+ foreach ($parameters as $key => $value)
+ {
+ $path = $this->replaceRouteParameter($path, $key, $value, $parameters);
+ }
+
+ return $path.$this->getRouteQueryString($parameters);
+ }
+
+ /**
+ * Replace a given route parameter for a route path.
+ *
+ * @param string $path
+ * @param string $key
+ * @param string $value
+ * @param array $parameters
+ * @return string
+ */
+ protected function replaceRouteParameter($path, $key, $value, array &$parameters)
+ {
+ $pattern = is_string($key) ? '/\{'.$key.'[\?]?\}/' : '/\{.*?\}/';
+
+ $path = preg_replace($pattern, $value, $path, 1, $count);
+
+ // If the parameter was actually replaced in the route path, we are going to remove
+ // it from the parameter array (by reference), which is so we can use any of the
+ // extra parameters as query string variables once we process all the matches.
+ if ($count > 0) unset($parameters[$key]);
+
+ return $path;
+ }
+
+ /**
+ * Get the query string for a given route.
+ *
+ * @param array $parameters
+ * @return string
+ */
+ protected function getRouteQueryString(array $parameters)
+ {
+ if (count($parameters) == 0) return '';
+
+ $query = http_build_query($keyed = $this->getStringParameters($parameters));
- $query = count($parameters) > 0 ? '?'.http_build_query($parameters) : '';
+ if (count($keyed) < count($parameters))
+ {
+ $query .= '&'.implode('&', $this->getNumericParameters($parameters));
+ }
- return $this->trimUrl($this->getRouteRoot($route, $domain), $path.$query);
+ return '?'.trim($query, '&');
+ }
+
+ /**
+ * Get the string parameters from a given list.
+ *
+ * @param array $parameters
+ * @return array
+ */
+ protected function getStringParameters(array $parameters)
+ {
+ return array_where($parameters, function($k, $v) { return is_string($k); });
+ }
+
+ /**
+ * Get the numeric parameters from a given list.
+ *
+ * @param array $parameters
+ * @return array
+ */
+ protected function getNumericParameters(array $parameters)
+ {
+ return array_where($parameters, function($k, $v) { return is_numeric($k); });
}
/**
@@ -228,11 +310,7 @@ protected function getRouteDomain($route, &$parameters)
*/
protected function formatDomain($route, &$parameters)
{
- return $this->addPortToDomain(preg_replace_sub(
-
- '/\{.*?\}/', $parameters, $this->getDomainAndScheme($route)
-
- ));
+ return $this->addPortToDomain($this->getDomainAndScheme($route));
}
/**
| false |
Other | laravel | framework | cc0bd4d8c8f86d4fb841d02d3a7a2106c4f037f9.json | Fix extra parameters to action method. | src/Illuminate/Routing/UrlGenerator.php | @@ -202,7 +202,9 @@ protected function toRoute($route, $parameters)
$path = preg_replace_sub('/\{.*?\}/', $parameters, $route->uri());
- return $this->trimUrl($this->getRouteRoot($route, $domain), $path);
+ $query = count($parameters) > 0 ? '?'.http_build_query($parameters) : '';
+
+ return $this->trimUrl($this->getRouteRoot($route, $domain), $path.$query);
}
/**
| true |
Other | laravel | framework | cc0bd4d8c8f86d4fb841d02d3a7a2106c4f037f9.json | Fix extra parameters to action method. | tests/Routing/RoutingUrlGeneratorTest.php | @@ -70,7 +70,7 @@ public function testBasicRouteGeneration()
$routes->add($route);
$this->assertEquals('http://www.foo.com/foo/bar', $url->route('foo'));
- $this->assertEquals('http://www.foo.com/foo/bar/taylor/breeze/otwell', $url->route('bar', array('taylor', 'otwell')));
+ $this->assertEquals('http://www.foo.com/foo/bar/taylor/breeze/otwell?fly=wall', $url->route('bar', array('taylor', 'otwell', 'fly' => 'wall')));
$this->assertEquals('https://www.foo.com/foo/bar', $url->route('baz'));
$this->assertEquals('http://www.foo.com/foo/bar', $url->action('foo@bar'));
}
| true |
Other | laravel | framework | e3be0deb504cf219544e99f881d2b39a0664e9e1.json | Move some code into refreshApplication. | src/Illuminate/Foundation/Testing/TestCase.php | @@ -29,10 +29,6 @@ public function setUp()
if ( ! $this->app)
{
$this->refreshApplication();
-
- $this->app->setRequestForConsoleEnvironment();
-
- $this->app->boot();
}
}
@@ -46,6 +42,10 @@ protected function refreshApplication()
$this->app = $this->createApplication();
$this->client = $this->createClient();
+
+ $this->app->setRequestForConsoleEnvironment();
+
+ $this->app->boot();
}
/** | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.