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 | 8e59e1af38e75055d16264c14d9d0268ae6ce5f8.json | Update Symfony dependencies to 2.4.* | src/Illuminate/Session/composer.json | @@ -13,7 +13,7 @@
"illuminate/cookie": "4.1.x",
"illuminate/encryption": "4.1.x",
"illuminate/support": "4.1.x",
- "symfony/http-foundation": "2.3.*"
+ "symfony/http-foundation": "2.4.*"
},
"require-dev": {
"illuminate/console": "4.1.x", | true |
Other | laravel | framework | 8e59e1af38e75055d16264c14d9d0268ae6ce5f8.json | Update Symfony dependencies to 2.4.* | src/Illuminate/Translation/composer.json | @@ -11,7 +11,7 @@
"php": ">=5.3.0",
"illuminate/filesystem": "4.1.x",
"illuminate/support": "4.1.x",
- "symfony/translation": "2.3.*"
+ "symfony/translation": "2.4.*"
},
"require-dev": {
"mockery/mockery": "0.7.2", | true |
Other | laravel | framework | 8e59e1af38e75055d16264c14d9d0268ae6ce5f8.json | Update Symfony dependencies to 2.4.* | src/Illuminate/Validation/composer.json | @@ -11,8 +11,8 @@
"php": ">=5.3.0",
"illuminate/container": "4.1.x",
"illuminate/support": "4.1.x",
- "symfony/http-foundation": "2.3.*",
- "symfony/translation": "2.3.*"
+ "symfony/http-foundation": "2.4.*",
+ "symfony/translation": "2.4.*"
},
"require-dev": {
"illuminate/database": "4.1.x", | true |
Other | laravel | framework | 8e59e1af38e75055d16264c14d9d0268ae6ce5f8.json | Update Symfony dependencies to 2.4.* | src/Illuminate/Workbench/composer.json | @@ -10,7 +10,7 @@
"require": {
"illuminate/filesystem": "4.1.x",
"illuminate/support": "4.1.x",
- "symfony/finder": "2.3.*"
+ "symfony/finder": "2.4.*"
},
"require-dev": {
"illuminate/console": "4.1.x", | true |
Other | laravel | framework | c4709f8b368aeeb64c3f22bcfff7292b969aa6e3.json | Remove custom repository for Boris. | composer.json | @@ -70,12 +70,6 @@
"mockery/mockery": "0.8.0",
"phpunit/phpunit": "3.7.*"
},
- "repositories": [
- {
- "type": "vcs",
- "url": "https://github.com/laravel/boris"
- }
- ],
"autoload": {
"classmap": [
["src/Illuminate/Queue/IlluminateQueueClosure.php"]
| false |
Other | laravel | framework | 52dfddaaea7de0be0ad79a0a515c88a7397b083a.json | Allow multiple attributes on sometimes. | src/Illuminate/Validation/Validator.php | @@ -172,7 +172,13 @@ public function sometimes($attribute, $rules, $callback)
{
$payload = new Fluent(array_merge($this->data, $this->files));
- if (call_user_func($callback, $payload)) $this->mergeRules($attribute, $rules);
+ if (call_user_func($callback, $payload))
+ {
+ foreach ((array) $attribute as $key)
+ {
+ $this->mergeRules($key, $rules);
+ }
+ }
}
/** | false |
Other | laravel | framework | a4f6d51c27864b77d062317ef6bf80de4aee9cc4.json | Fix doc blocks and stuff. | src/Illuminate/Filesystem/Filesystem.php | @@ -353,7 +353,7 @@ public function copyDirectory($directory, $destination, $options = null)
*
* @param string $directory
* @param bool $preserve
- * @return void
+ * @return bool
*/
public function deleteDirectory($directory, $preserve = false)
{
@@ -389,11 +389,10 @@ public function deleteDirectory($directory, $preserve = false)
* Empty the specified directory of all files and folders.
*
* @param string $directory
- * @return void
+ * @return bool
*/
public function cleanDirectory($directory)
{
-
return $this->deleteDirectory($directory, true);
}
| false |
Other | laravel | framework | 0fa8ebf01e7ec300c4f51179becf6268780e67c6.json | Add getCachingIterator method to collection. | src/Illuminate/Support/Collection.php | @@ -4,6 +4,7 @@
use Countable;
use ArrayAccess;
use ArrayIterator;
+use CachingIterator;
use IteratorAggregate;
use Illuminate\Support\Contracts\JsonableInterface;
use Illuminate\Support\Contracts\ArrayableInterface;
@@ -427,6 +428,16 @@ public function getIterator()
return new ArrayIterator($this->items);
}
+ /**
+ * Get a CachingIterator instance.
+ *
+ * @return \CachingIterator
+ */
+ public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING)
+ {
+ return new CachingIterator($this->getIterator(), $flags);
+ }
+
/**
* Count the number of items in the collection.
*
| true |
Other | laravel | framework | 0fa8ebf01e7ec300c4f51179becf6268780e67c6.json | Add getCachingIterator method to collection. | tests/Support/SupportCollectionTest.php | @@ -106,6 +106,13 @@ public function testIterable()
}
+ public function testCachingIterator()
+ {
+ $c = new Collection(array('foo'));
+ $this->assertInstanceOf('CachingIterator', $c->getCachingIterator());
+ }
+
+
public function testFilter()
{
$c = new Collection(array(array('id' => 1, 'name' => 'Hello'), array('id' => 2, 'name' => 'World')));
| true |
Other | laravel | framework | 33c2a3ee57d422d2be1fbfec12b25d5c3b3e3836.json | Remove unused local variable.
Signed-off-by: crynobone <crynobone@gmail.com> | src/Illuminate/Foundation/Application.php | @@ -354,8 +354,6 @@ protected function markAsRegistered($provider)
*/
public function loadDeferredProviders()
{
- $me = $this;
-
// We will simply spin through each of the deferred providers and register each
// one and boot them if the application has booted. This should make each of
// the remaining services available to this application for immediate use. | false |
Other | laravel | framework | 415c5adba4f6f0f944d3a6d492af4988a4335655.json | Replace incorrect return type | src/Illuminate/Database/Eloquent/Model.php | @@ -1425,7 +1425,7 @@ public function freshTimestamp()
/**
* Get a fresh timestamp for the model.
*
- * @return DateTime
+ * @return string
*/
public function freshTimestampString()
{ | false |
Other | laravel | framework | 6e121e373c3c1365e695bbd95836620ecdf7a6f2.json | add new firing method to event dispatcher. | src/Illuminate/Events/Dispatcher.php | @@ -32,6 +32,13 @@ class Dispatcher {
*/
protected $sorted = array();
+ /**
+ * The event firing stack.
+ *
+ * @var array
+ */
+ protected $firing = array();
+
/**
* Create a new event dispatcher instance.
*
@@ -155,6 +162,16 @@ public function flush($event)
$this->fire($event.'_queue');
}
+ /**
+ * Get the event that is currently firing.
+ *
+ * @return string
+ */
+ public function firing()
+ {
+ return last($this->firing);
+ }
+
/**
* Fire an event and call the listeners.
*
@@ -172,7 +189,7 @@ public function fire($event, $payload = array(), $halt = false)
// payload to each of them so that they receive each of these arguments.
if ( ! is_array($payload)) $payload = array($payload);
- $payload[] = $event;
+ $this->firing[] = $event;
foreach ($this->getListeners($event) as $listener)
{
@@ -183,6 +200,8 @@ public function fire($event, $payload = array(), $halt = false)
// listeners. Otherwise we will add the response on the response list.
if ( ! is_null($response) and $halt)
{
+ array_pop($this->firing);
+
return $response;
}
@@ -194,6 +213,8 @@ public function fire($event, $payload = array(), $halt = false)
$responses[] = $response;
}
+ array_pop($this->firing);
+
return $halt ? null : $responses;
}
| true |
Other | laravel | framework | 6e121e373c3c1365e695bbd95836620ecdf7a6f2.json | add new firing method to event dispatcher. | src/Illuminate/Foundation/changes.json | @@ -13,7 +13,8 @@
{"message": "Allow route names to be specified on resources.", "backport": null},
{"message": "Collection `push` now appends. New `prepend` method on collections.", "backport": null},
{"message": "Use environment for log file name.", "backport": null},
- {"message": "Use 'bit' as storage type for boolean on SQL Server.", "backport": null}
+ {"message": "Use 'bit' as storage type for boolean on SQL Server.", "backport": null},
+ {"message": "Added new 'firing' method to event dispatcher, deprecated passing of event as last parameter.", "backport": null}
],
"4.0.x": [
{"message": "Added implode method to query builder and Collection class.", "backport": null}, | true |
Other | laravel | framework | 6e121e373c3c1365e695bbd95836620ecdf7a6f2.json | add new firing method to event dispatcher. | tests/Events/EventsDispatcherTest.php | @@ -25,7 +25,7 @@ public function testContainerResolutionOfEventHandlers()
{
$d = new Dispatcher($container = m::mock('Illuminate\Container\Container'));
$container->shouldReceive('make')->once()->with('FooHandler')->andReturn($handler = m::mock('StdClass'));
- $handler->shouldReceive('onFooEvent')->once()->with('foo', 'bar', 'foo');
+ $handler->shouldReceive('onFooEvent')->once()->with('foo', 'bar');
$d->listen('foo', 'FooHandler@onFooEvent');
$d->fire('foo', array('foo', 'bar'));
}
@@ -35,7 +35,7 @@ public function testContainerResolutionOfEventHandlersWithDefaultMethods()
{
$d = new Dispatcher($container = m::mock('Illuminate\Container\Container'));
$container->shouldReceive('make')->once()->with('FooHandler')->andReturn($handler = m::mock('StdClass'));
- $handler->shouldReceive('handle')->once()->with('foo', 'bar', 'foo');
+ $handler->shouldReceive('handle')->once()->with('foo', 'bar');
$d->listen('foo', 'FooHandler');
$d->fire('foo', array('foo', 'bar'));
}
@@ -81,4 +81,16 @@ public function testListenersCanBeRemoved()
$this->assertFalse(isset($_SERVER['__event.test']));
}
+
+ public function testFiringReturnsCurrentlyFiredEvent()
+ {
+ unset($_SERVER['__event.test']);
+ $d = new Dispatcher;
+ $d->listen('foo', function() use ($d) { $_SERVER['__event.test'] = $d->firing(); $d->fire('bar'); });
+ $d->listen('bar', function() use ($d) { $_SERVER['__event.test'] = $d->firing(); });
+ $d->fire('foo');
+
+ $this->assertEquals('bar', $_SERVER['__event.test']);
+ }
+
}
\ No newline at end of file | true |
Other | laravel | framework | 6e121e373c3c1365e695bbd95836620ecdf7a6f2.json | add new firing method to event dispatcher. | tests/Routing/RoutingRouteTest.php | @@ -114,6 +114,26 @@ public function testBasicBeforeFilters()
$router->filter('foo', function($route, $request, $bar, $baz) { return null; });
$router->filter('bar', function($route, $request, $boom) { return $boom; });
$this->assertEquals('boom', $router->dispatch(Request::create('foo/bar', 'GET'))->getContent());
+
+ /**
+ * Basic filter parameter
+ */
+ unset($_SERVER['__route.filter']);
+ $router = $this->getRouter();
+ $router->get('foo/bar', array('before' => 'foo:bar', function() { return 'hello'; }));
+ $router->filter('foo', function($route, $request, $value = null) { $_SERVER['__route.filter'] = $value; });
+ $router->dispatch(Request::create('foo/bar', 'GET'));
+ $this->assertEquals('bar', $_SERVER['__route.filter']);
+
+ /**
+ * Optional filter parameter
+ */
+ unset($_SERVER['__route.filter']);
+ $router = $this->getRouter();
+ $router->get('foo/bar', array('before' => 'foo', function() { return 'hello'; }));
+ $router->filter('foo', function($route, $request, $value = null) { $_SERVER['__route.filter'] = $value; });
+ $router->dispatch(Request::create('foo/bar', 'GET'));
+ $this->assertEquals(null, $_SERVER['__route.filter']);
}
| true |
Other | laravel | framework | 3f7c47cb243be3ba201bf75c6c0c38e7b96b43b3.json | allow port on remote host. | src/Illuminate/Remote/SecLibGateway.php | @@ -13,6 +13,13 @@ class SecLibGateway implements GatewayInterface {
*/
protected $host;
+ /**
+ * The SSH port on the server.
+ *
+ * @var int
+ */
+ protected $port = 22;
+
/**
* The authentication credential set.
*
@@ -36,10 +43,31 @@ class SecLibGateway implements GatewayInterface {
*/
public function __construct($host, array $auth, Filesystem $files)
{
- $this->host = $host;
$this->auth = $auth;
$this->files = $files;
- $this->connection = new Net_SFTP($this->host);
+ $this->setHostAndPort($host);
+
+ $this->connection = new Net_SFTP($this->host, $this->port);
+ }
+
+ /**
+ * Set the host and port from a full host string.
+ *
+ * @param string $host
+ * @return void
+ */
+ protected function setHostAndPort($host)
+ {
+ if ( ! str_contains($host, ':'))
+ {
+ $this->host = $host;
+ }
+ else
+ {
+ list($this->host, $this->post) = explode($host, ':');
+
+ $this->port = (int) $this->port;
+ }
}
/** | false |
Other | laravel | framework | 73aceffc41747cdfe67e0ad27d054ba651a434a2.json | update doc block. | src/Illuminate/Http/Request.php | @@ -249,7 +249,7 @@ public function cookie($key = null, $default = null)
*
* @param string $key
* @param mixed $default
- * @return \Symfony\Component\HttpFoundation\File\UploadedFile
+ * @return \Symfony\Component\HttpFoundation\File\UploadedFile|array
*/
public function file($key = null, $default = null)
{ | false |
Other | laravel | framework | 207ff3dc178cde9f9397f68ae8fca4cc2cdb9cdf.json | add new line. | src/Illuminate/Container/Container.php | @@ -529,6 +529,7 @@ public function offsetSet($key, $value)
public function offsetUnset($key)
{
unset($this->bindings[$key]);
+
unset($this->instances[$key]);
}
| false |
Other | laravel | framework | f908fcdb506038415ebbe4e31d83b6694f4bd83a.json | pass keys to the map method on the Collection. | src/Illuminate/Foundation/changes.json | @@ -47,6 +47,7 @@
{"message": "Added 'reduce' collection to Collection, and 'min' and 'max' to Eloquent Collection.", "backport": null},
{"message": "Added 'firstOrCreate' and 'firstOrNew' methods to Eloquent model.", "backport": null},
{"message": "Added Redirect::away method to always redirect to external URL with no validation.", "backport": null},
- {"message": "Added 'double' method to Schema builder.", "backport": null}
+ {"message": "Added 'double' method to Schema builder.", "backport": null},
+ {"message": "Pass keys to 'map' method on Collection.", "backport": null}
]
} | true |
Other | laravel | framework | f908fcdb506038415ebbe4e31d83b6694f4bd83a.json | pass keys to the map method on the Collection. | src/Illuminate/Support/Collection.php | @@ -188,7 +188,7 @@ public function each(Closure $callback)
*/
public function map(Closure $callback)
{
- return new static(array_map($callback, $this->items));
+ return new static(array_map($callback, $this->items, array_keys($this->items)));
}
/**
| true |
Other | laravel | framework | acda27b47f0858c492b920447fb838014fa1210b.json | use environment for log file name. | src/Illuminate/Foundation/changes.json | @@ -11,7 +11,8 @@
{"message": "Added live debug console via 'debug' Artisan command.", "backport": null},
{"message": "Make Boris available from Tinker command when available.", "backport": null},
{"message": "Allow route names to be specified on resources.", "backport": null},
- {"message": "Collection `push` now appends. New `prepend` method on collections.", "backport": null}
+ {"message": "Collection `push` now appends. New `prepend` method on collections.", "backport": null},
+ {"message": "Use environment for log file name.", "backport": null}
],
"4.0.x": [
{"message": "Added implode method to query builder and Collection class.", "backport": null}, | true |
Other | laravel | framework | acda27b47f0858c492b920447fb838014fa1210b.json | use environment for log file name. | src/Illuminate/Log/LogServiceProvider.php | @@ -1,5 +1,6 @@
<?php namespace Illuminate\Log;
+use Monolog\Logger;
use Illuminate\Support\ServiceProvider;
class LogServiceProvider extends ServiceProvider {
@@ -18,7 +19,9 @@ class LogServiceProvider extends ServiceProvider {
*/
public function register()
{
- $logger = new Writer(new \Monolog\Logger('log'), $this->app['events']);
+ $logger = new Writer(
+ new Logger($this->app['env']), $this->app['events']
+ );
$this->app->instance('log', $logger);
| true |
Other | laravel | framework | 6f36d658d936b720c4e195b5f5545e51829c2ff1.json | add helper methods to json response. | src/Illuminate/Http/JsonResponse.php | @@ -14,4 +14,32 @@ 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 | false |
Other | laravel | framework | 03f8744b71e45a6f53af243284eb5b3e99de3866.json | use intersect when filling. | src/Illuminate/Database/Eloquent/Model.php | @@ -293,7 +293,7 @@ public static function observe($class)
*/
public function fill(array $attributes)
{
- foreach ($attributes as $key => $value)
+ foreach ($this->fillableFromArray($attributes) as $key => $value)
{
$key = $this->removeTableFromKey($key);
@@ -313,6 +313,22 @@ public function fill(array $attributes)
return $this;
}
+ /**
+ * Get the fillable attributes of a given array.
+ *
+ * @param array $attributes
+ * @return array
+ */
+ protected function fillableFromArray(array $attributes)
+ {
+ if (count($this->fillable) > 0)
+ {
+ return array_intersect_key($attributes, array_flip($this->fillable));
+ }
+
+ return $attributes;
+ }
+
/**
* Create a new instance of the given model.
* | false |
Other | laravel | framework | e405c532a06f8de4503d78fcdab77046177497cc.json | update version constant. | src/Illuminate/Foundation/Application.php | @@ -32,7 +32,7 @@ class Application extends Container implements HttpKernelInterface, ResponsePrep
*
* @var string
*/
- const VERSION = '4.0.7';
+ const VERSION = '4.1-dev';
/**
* Indicates if the application has "booted". | false |
Other | laravel | framework | 3211024074e95b092b36749bffc3a2a0615e67c3.json | add arrayobject to checks. | src/Illuminate/Http/Response.php | @@ -93,7 +93,9 @@ protected function morphToJson($content)
*/
protected function shouldBeJson($content)
{
- return $content instanceof JsonableInterface or is_array($content);
+ return ($content instanceof JsonableInterface or
+ $content instanceof ArrayObject or
+ is_array($content));
}
/** | false |
Other | laravel | framework | 83bad25e26edf04891c1bee6de1b596c0ef94628.json | register env command. | src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php | @@ -36,7 +36,7 @@ public function register()
return new EnvironmentCommand;
});
- $this->commands('command.changes');
+ $this->commands('command.changes', 'command.environment');
}
/** | false |
Other | laravel | framework | 375f2d82861b03f02220cc8b87409acde8d9d27b.json | fix bugs in env. | src/Illuminate/Foundation/Console/EnvironmentCommand.php | @@ -2,7 +2,7 @@
use Illuminate\Console\Command;
-class ChangesCommand extends Command {
+class EnvironmentCommand extends Command {
/**
* The console command name.
@@ -25,7 +25,7 @@ class ChangesCommand extends Command {
*/
public function fire()
{
- $this->line('<info>Current application environment:</info> <comment>'.$this->app['env'].'</comment>');
+ $this->line('<info>Current application environment:</info> <comment>'.$this->laravel['env'].'</comment>');
}
}
\ No newline at end of file | false |
Other | laravel | framework | 3d0400e55a81b79d3352670f2e24f7358eb95d10.json | allow namespace argument on route groups. | src/Illuminate/Routing/Router.php | @@ -583,9 +583,30 @@ public function mergeWithLastGroup($new)
*/
public static function mergeGroup($new, $old)
{
+ $new['namespace'] = static::formatUsesPrefix($new, $old);
+
$new['prefix'] = static::formatGroupPrefix($new, $old);
- return array_merge_recursive(array_except($old, array('prefix', 'domain')), $new);
+ return array_merge_recursive(array_except($old, array('namespace', 'prefix', 'domain')), $new);
+ }
+
+ /**
+ * Format the uses prefix for the new group attributes.
+ *
+ * @param array $new
+ * @param array $old
+ * @return string
+ */
+ protected static function formatUsesPrefix($new, $old)
+ {
+ if (isset($new['namespace']))
+ {
+ return trim(array_get($old, 'namespace'), '\\').'\\'.trim($new['namespace'], '\\');
+ }
+ else
+ {
+ return array_get($old, 'namespace');
+ }
}
/**
@@ -716,9 +737,22 @@ protected function getControllerAction($action)
{
if (is_string($action)) $action = array('uses' => $action);
+ // Here we'll get an instance of this controller dispatcher and hand it off to
+ // the Closure so it will be used to resolve the class instances out of our
+ // IoC container instance and call the appropriate methods on the class.
+ if (count($this->groupStack) > 0)
+ {
+ $action['uses'] = $this->prependGroupUses($action['uses']);
+ }
+
+ // Here we'll get an instance of this controller dispatcher and hand it off to
+ // the Closure so it will be used to resolve the class instances out of our
+ // IoC container instance and call the appropriate methods on the class.
$action['controller'] = $action['uses'];
- return array_set($action, 'uses', $this->getClassClosure($action['uses']));
+ $closure = $this->getClassClosure($action['uses']);
+
+ return array_set($action, 'uses', $closure);
}
/**
@@ -751,6 +785,19 @@ protected function getClassClosure($controller)
};
}
+ /**
+ * Prepend the last group uses onto the use clause.
+ *
+ * @param string $uses
+ * @return string
+ */
+ protected function prependGroupUses($uses)
+ {
+ $group = last($this->groupStack);
+
+ return isset($group['namespace']) ? $group['namespace'].'\\'.$uses : $uses;
+ }
+
/**
* Dispatch the request to the application.
*
| true |
Other | laravel | framework | 3d0400e55a81b79d3352670f2e24f7358eb95d10.json | allow namespace argument on route groups. | tests/Routing/RoutingRouteTest.php | @@ -347,10 +347,10 @@ public function testRouteCompilationAgainstUris()
public function testGroupMerging()
{
$old = array('prefix' => 'foo/bar/');
- $this->assertEquals(array('prefix' => 'foo/bar/baz'), Router::mergeGroup(array('prefix' => 'baz'), $old));
+ $this->assertEquals(array('prefix' => 'foo/bar/baz', 'namespace' => null), Router::mergeGroup(array('prefix' => 'baz'), $old));
$old = array('domain' => 'foo');
- $this->assertEquals(array('domain' => 'baz', 'prefix' => null), Router::mergeGroup(array('domain' => 'baz'), $old));
+ $this->assertEquals(array('domain' => 'baz', 'prefix' => null, 'namespace' => null), Router::mergeGroup(array('domain' => 'baz'), $old));
}
@@ -396,6 +396,34 @@ public function testRouteGrouping()
}
+ public function testMergingControllerUses()
+ {
+ $router = $this->getRouter();
+ $router->group(array('namespace' => 'Namespace'), function() use ($router)
+ {
+ $router->get('foo/bar', 'Controller');
+ });
+ $routes = $router->getRoutes()->getRoutes();
+ $action = $routes[0]->getAction();
+
+ $this->assertEquals('Namespace\\Controller', $action['controller']);
+
+
+ $router = $this->getRouter();
+ $router->group(array('namespace' => 'Namespace'), function() use ($router)
+ {
+ $router->group(array('namespace' => 'Nested'), function() use ($router)
+ {
+ $router->get('foo/bar', 'Controller');
+ });
+ });
+ $routes = $router->getRoutes()->getRoutes();
+ $action = $routes[0]->getAction();
+
+ $this->assertEquals('Namespace\\Nested\\Controller', $action['controller']);
+ }
+
+
public function testResourceRouting()
{
$router = $this->getRouter();
| true |
Other | laravel | framework | be734eca9ba8ec7142c06d2662356e69c12f5257.json | return bulider instance on setBindings. | src/Illuminate/Database/Query/Builder.php | @@ -1566,11 +1566,13 @@ public function getBindings()
* Set the bindings on the query builder.
*
* @param array $bindings
- * @return void
+ * @return \Illuminate\Database\Query\Builder
*/
public function setBindings(array $bindings)
{
$this->bindings = $bindings;
+
+ return $this;
}
/** | false |
Other | laravel | framework | 44ef0d0e766d665a29c93fc516dd2f50b4ae4500.json | fix bug in router. | src/Illuminate/Routing/Router.php | @@ -1165,7 +1165,7 @@ public function withoutFilters($callback)
{
$this->disableFilters();
- call_user_func($callback0);
+ call_user_func($callback);
$this->enableFilters();
}
| false |
Other | laravel | framework | 05dccf1b72c38cba55db4f2b9140e305792657c9.json | fix bug with provider booting. | src/Illuminate/Exception/Handler.php | @@ -284,7 +284,7 @@ protected function handlesException(Closure $handler, $exception)
{
$reflection = new ReflectionFunction($handler);
- return $reflection->getNumberOfParameters() == 0 or $this->hints($reflection, $exception);
+ return $reflection->getNumberOfParameters() == 0 || $this->hints($reflection, $exception);
}
/** | true |
Other | laravel | framework | 05dccf1b72c38cba55db4f2b9140e305792657c9.json | fix bug with provider booting. | src/Illuminate/Foundation/Application.php | @@ -329,6 +329,11 @@ public function register($provider, $options = array())
$this->markAsRegistered($provider);
+ // If the application has already booted, we will call this boot method on
+ // the provider class so it has an opportunity to do its boot logic and
+ // will be ready for any usage by the developer's application logics.
+ if ($this->booted) $provider->boot();
+
return $provider;
}
| true |
Other | laravel | framework | 092f8473cef58ab67d6287194ebadebdd3a46498.json | Add Syntax Highlighting
Personally, I think syntax highlighting makes the code in this README easier to read. Maybe you agree, maybe you don't, thought I'd suggest it anyway. | src/Illuminate/Database/README.md | @@ -6,7 +6,7 @@ The Illuminate Database component is a full database toolkit for PHP, providing
First, create a new "Capsule" manager instance. Capsule aims to make configuring the library for usage outside of the Laravel framework as easy as possible.
-```
+```PHP
use Illuminate\Database\Capsule\Manager as Capsule;
$capsule = new Capsule;
@@ -41,17 +41,17 @@ Once the Capsule instance has been registered. You may use it like so:
**Using The Query Builder**
-```
+```PHP
$users = Capsule::table('users')->where('votes', '>', 100)->get();
```
Other core methods may be accessed directly from the Capsule in the same manner as from the DB facade:
-```
+```PHP
$results = Capsule::select('select * from users where id = ?', array(1));
```
**Using The Schema Builder**
-```
+```PHP
Capsule::schema()->create('users', function($table)
{
$table->increments('id');
@@ -62,7 +62,7 @@ Capsule::schema()->create('users', function($table)
**Using The Eloquent ORM**
-```
+```PHP
class User extends Illuminate\Database\Eloquent\Model {}
$users = User::where('votes', '>', 1)->get(); | false |
Other | laravel | framework | 09ec31fa509dedbca7627d32e45ef0a966f07ea2.json | Fix "slow Redirect". | src/Illuminate/Routing/Router.php | @@ -8,6 +8,7 @@
use Illuminate\Container\Container;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
+use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class Router implements HttpKernelInterface, RouteFiltererInterface {
@@ -1146,7 +1147,7 @@ public function callRouteFilter($filter, $parameters, $route, $request, $respons
*/
protected function prepareResponse($response)
{
- if ( ! $response instanceof Response)
+ if ( ! $response instanceof SymfonyResponse)
{
$response = new Response($response);
}
| false |
Other | laravel | framework | 7836868e0125e29ed6255f27727c2933105991ec.json | Do strict check on MAC. | src/Illuminate/Encryption/Encrypter.php | @@ -143,7 +143,7 @@ protected function getJsonPayload($payload)
*/
protected function validMac(array $payload)
{
- return ($payload['mac'] == $this->hash($payload['iv'], $payload['value']));
+ return ($payload['mac'] === $this->hash($payload['iv'], $payload['value']));
}
/** | false |
Other | laravel | framework | 9857193607b53373c078eb591771779d9f3812d8.json | Fix possible unwanted loading of boolean operator. | src/Illuminate/Database/Query/Builder.php | @@ -276,6 +276,11 @@ public function leftJoin($table, $first, $operator = null, $second = null)
*/
public function where($column, $operator = null, $value = null, $boolean = 'and')
{
+ if ($this->invalidOperatorAndValue($operator, $value))
+ {
+ throw new \InvalidArgumentException("Value must be provided.");
+ }
+
// If the columns is actually a Closure instance, we will assume the developer
// wants to begin a nested where statement which is wrapped in parenthesis.
// We'll add that Closure to the query then return back out immediately.
@@ -336,6 +341,20 @@ public function orWhere($column, $operator = null, $value = null)
return $this->where($column, $operator, $value, 'or');
}
+ /**
+ * Determine if the given operator and value combination is legal.
+ *
+ * @param string $operator
+ * @param mxied $value
+ * @return bool
+ */
+ protected function invalidOperatorAndValue($operator, $value)
+ {
+ $isOperator = in_array($operator, $this->operators);
+
+ return ($isOperator and $operator != '=' and is_null($value));
+ }
+
/**
* Add a raw where clause to the query.
* | false |
Other | laravel | framework | 7f2822b40e228b5e2bb1da9ccc0d3ba21e557aa4.json | Add equals to cache store. | src/Illuminate/Cache/DatabaseStore.php | @@ -60,7 +60,7 @@ public function get($key)
{
$prefixed = $this->prefix.$key;
- $cache = $this->table()->where('key', $prefixed)->first();
+ $cache = $this->table()->where('key', '=', $prefixed)->first();
// If we have a cache record we will check the expiration time against current
// time on the system and see if the record has expired. If it has, we will
@@ -103,7 +103,7 @@ public function put($key, $value, $minutes)
}
catch (\Exception $e)
{
- $this->table()->where('key', $key)->update(compact('value', 'expiration'));
+ $this->table()->where('key', '=', $key)->update(compact('value', 'expiration'));
}
}
@@ -161,7 +161,7 @@ public function forever($key, $value)
*/
public function forget($key)
{
- $this->table()->where('key', $this->prefix.$key)->delete();
+ $this->table()->where('key', '=', $this->prefix.$key)->delete();
}
/** | false |
Other | laravel | framework | 024e5fbaf7a67008eec1bc99eaeefd8755a88cee.json | Add missing tab
Whoops, something went wrong here. | src/Illuminate/Queue/IronQueue.php | @@ -77,7 +77,7 @@ public function push($job, $data = '', $queue = null)
* @param string $queue
* @return mixed
*/
-public function later($delay, $job, $data = '', $queue = null)
+ public function later($delay, $job, $data = '', $queue = null)
{
$delay = $this->getSeconds($delay);
@@ -181,4 +181,4 @@ public function getIron()
return $this->iron;
}
-}
\ No newline at end of file
+} | false |
Other | laravel | framework | 68d5c2f2cb407a15ffb979b0848179ee3cc9feef.json | remove unused code in provider repository. | src/Illuminate/Foundation/ProviderRepository.php | @@ -168,17 +168,6 @@ public function writeManifest($manifest)
return $manifest;
}
- /**
- * Get the manifest file path.
- *
- * @param \Illuminate\Foundation\Application $app
- * @return string
- */
- protected function getManifestPath($app)
- {
- return $this->manifestPath;
- }
-
/**
* Create a fresh manifest array.
* | false |
Other | laravel | framework | 74dad49cd0e8334c78474655161a19ad296243a8.json | fix possible bug in session keep. | src/Illuminate/Session/Store.php | @@ -198,7 +198,7 @@ public function keep($keys = null)
*/
protected function mergeNewFlashes(array $keys)
{
- $values = array_unique(array_merge($this->get('flash.new'), $keys));
+ $values = array_unique(array_merge($this->get('flash.new', array()), $keys));
$this->put('flash.new', $values);
} | false |
Other | laravel | framework | ce3269fea7359af582a9f5e5436b5801dd259d98.json | Update typo in change log. | src/Illuminate/Foundation/changes.json | @@ -8,7 +8,7 @@
{"message": "Rebuild the routing layer for speed and efficiency.", "backport": null},
{"message": "Added morphToMany relation for polymorphic many-to-many relations.", "backport": null},
{"message": "Deprecated column renaming. Deprecated dropping SQLite columns.", "backport": null},
- {"message": "Added live debug consol via 'debug' Artisan command.", "backport": null}
+ {"message": "Added live debug console via 'debug' Artisan command.", "backport": null}
],
"4.0.x": [
{"message": "Added implode method to query builder and Collection class.", "backport": null}, | false |
Other | laravel | framework | bdb3b2ad04f711df21617ce60efcab478c4c0852.json | Add short-cut to debugger. | src/Illuminate/Foundation/Application.php | @@ -219,6 +219,16 @@ public function startExceptionHandling()
$this['exception']->setDebug($this['config']['app.debug']);
}
+ /**
+ * Attach the live debugger provider.
+ *
+ * @return void
+ */
+ public function attachDebugger()
+ {
+ $this->augment('Illuminate\Exception\LiveServiceProvider');
+ }
+
/**
* Get the current application environment.
* | false |
Other | laravel | framework | 7f1cfa5c62d98a32638a5c389c39f9e8143bd954.json | Deprecate a few methods. | src/Illuminate/Database/Schema/Blueprint.php | @@ -212,7 +212,7 @@ public function dropColumn($columns)
*/
public function renameColumn($from, $to)
{
- return $this->addCommand('renameColumn', compact('from', 'to'));
+ throw new \BadMethodCallException("Column renaming has been deprecated.");
}
/** | true |
Other | laravel | framework | 7f1cfa5c62d98a32638a5c389c39f9e8143bd954.json | Deprecate a few methods. | src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php | @@ -241,7 +241,7 @@ public function compileDropIfExists(Blueprint $blueprint, Fluent $command)
*/
public function compileDropColumn(Blueprint $blueprint, Fluent $command, Connection $connection)
{
- throw new \RuntimeException("Dropping columns not supported on SQLite");
+ throw new \BadMethodCallException("SQLite column dropping has been deprecated.");
}
/** | true |
Other | laravel | framework | 4dcb2ee46dcc2382cb11cd28d773a0ca4582e58d.json | Normalize test results across Windows and Unix. | tests/Routing/RoutingControllerGeneratorTest.php | @@ -15,26 +15,47 @@ public function testFullControllerCanBeCreated()
{
$gen = new ControllerGenerator($files = m::mock('Illuminate\Filesystem\Filesystem[put]'));
$controller = file_get_contents(__DIR__.'/fixtures/controller.php');
- $files->shouldReceive('put')->once()->with(__DIR__.'/FooController.php', $controller);
+ $files->shouldReceive('put')->once()->andReturnUsing(function($path, $actual)
+ {
+ $_SERVER['__controller.actual'] = $actual;
+ });
$gen->make('FooController', __DIR__);
+
+ $controller = preg_replace('/\s+/', '', $controller);
+ $actual = preg_replace('/\s+/', '', $_SERVER['__controller.actual']);
+ $this->assertEquals($controller, $actual);
}
public function testOnlyPartialControllerCanBeCreated()
{
$gen = new ControllerGenerator($files = m::mock('Illuminate\Filesystem\Filesystem[put]'));
$controller = file_get_contents(__DIR__.'/fixtures/only_controller.php');
- $files->shouldReceive('put')->once()->with(__DIR__.'/FooController.php', $controller);
+ $files->shouldReceive('put')->once()->andReturnUsing(function($path, $actual)
+ {
+ $_SERVER['__controller.actual'] = $actual;
+ });
$gen->make('FooController', __DIR__, array('only' => array('index', 'show')));
+
+ $controller = preg_replace('/\s+/', '', $controller);
+ $actual = preg_replace('/\s+/', '', $_SERVER['__controller.actual']);
+ $this->assertEquals($controller, $actual);
}
public function testExceptPartialControllerCanBeCreated()
{
$gen = new ControllerGenerator($files = m::mock('Illuminate\Filesystem\Filesystem[put]'));
$controller = file_get_contents(__DIR__.'/fixtures/except_controller.php');
- $files->shouldReceive('put')->once()->with(__DIR__.'/FooController.php', $controller);
+ $files->shouldReceive('put')->once()->andReturnUsing(function($path, $actual)
+ {
+ $_SERVER['__controller.actual'] = $actual;
+ });
$gen->make('FooController', __DIR__, array('except' => array('index', 'show')));
+
+ $controller = preg_replace('/\s+/', '', $controller);
+ $actual = preg_replace('/\s+/', '', $_SERVER['__controller.actual']);
+ $this->assertEquals($controller, $actual);
}
}
\ No newline at end of file | false |
Other | laravel | framework | fb84e307e34d7d314a0d269f4ca71790b6c7a352.json | simplify code to foreach.' | src/Illuminate/Foundation/Application.php | @@ -332,10 +332,10 @@ public function loadDeferredProviders()
// We will simply spin through each of the deferred providers and register each
// one and boot them if the application has booted. This should make each of
// the remaining services available to this application for immediate use.
- array_walk($this->deferredServices, function($p) use ($me)
+ foreach ($this->deferredServices as $provider)
{
- $this->registerDeferredProvider($p);
- });
+ $this->registerDeferredProvider($provider);
+ }
$this->deferredServices = array();
} | false |
Other | laravel | framework | 4b43571517918f58d76a64476c7ddbdc3995f849.json | Add comment to many to many. | src/Illuminate/Database/Eloquent/Model.php | @@ -584,6 +584,9 @@ public function morphMany($related, $name, $type = null, $id = null)
{
$instance = new $related;
+ // Here we will gather up the morph type and ID for the relationship so that we
+ // can properly query the intermediate table of a relation. Finally, we will
+ // get the table and create the relationship instances for the developers.
list($type, $id) = $this->getMorphs($name, $type, $id);
$table = $instance->getTable(); | false |
Other | laravel | framework | 19a94c33645fec8fcaa8b3fdd87900853790056a.json | Fix variable casing.
One more. | src/Illuminate/Foundation/Application.php | @@ -451,7 +451,7 @@ public function close($callback)
*/
public function finish($callback)
{
- $this->finishCallBacks[] = $callback;
+ $this->finishCallbacks[] = $callback;
}
/** | false |
Other | laravel | framework | e04ed2899eba1c7b04d00d99504f0fb9a2c8e450.json | Add polymorphic many to many tests. | src/Illuminate/Database/Eloquent/Relations/MorphToMany.php | @@ -43,7 +43,7 @@ protected function setWhere()
{
parent::setWhere();
- $this->query->where($this->morphType, get_class($this->parent));
+ $this->query->where($this->table.'.'.$this->morphType, get_class($this->parent));
return $this;
}
@@ -58,7 +58,7 @@ public function addEagerConstraints(array $models)
{
parent::addEagerConstraints($models);
- $this->query->where($this->morphType, get_class($this->parent));
+ $this->query->where($this->table.'.'.$this->morphType, get_class($this->parent));
}
/**
@@ -82,19 +82,9 @@ protected function createAttachRecord($id, $timed)
*/
protected function newPivotQuery()
{
- $query = $this->newPivotStatement();
+ $query = parent::newPivotQuery();
- return $query->where($this->foreignKey, $this->parent->getKey());
- }
-
- /**
- * Get a new plain query builder for the pivot table.
- *
- * @return \Illuminate\Database\Query\Builder
- */
- public function newPivotStatement()
- {
- return parent::newPivotStatement()->where($this->morphType, get_class($this->parent));
+ return $query->where($this->morphType, get_class($this->parent));
}
/** | true |
Other | laravel | framework | e04ed2899eba1c7b04d00d99504f0fb9a2c8e450.json | Add polymorphic many to many tests. | tests/Database/DatabaseEloquentMorphToManyTest.php | @@ -0,0 +1,109 @@
+<?php
+
+use Mockery as m;
+use Illuminate\Database\Eloquent\Collection;
+use Illuminate\Database\Eloquent\Relations\MorphToMany;
+
+class DatabaseEloquentMorphToManyTest extends PHPUnit_Framework_TestCase {
+
+ public function tearDown()
+ {
+ m::close();
+ }
+
+
+ public function testEagerConstraintsAreProperlyAdded()
+ {
+ $relation = $this->getRelation();
+ $relation->getQuery()->shouldReceive('whereIn')->once()->with('taggables.taggable_id', array(1, 2));
+ $relation->getQuery()->shouldReceive('where')->once()->with('taggables.taggable_type', get_class($relation->getParent()));
+ $model1 = new EloquentMorphToManyModelStub;
+ $model1->id = 1;
+ $model2 = new EloquentMorphToManyModelStub;
+ $model2->id = 2;
+ $relation->addEagerConstraints(array($model1, $model2));
+ }
+
+
+ public function testAttachInsertsPivotTableRecord()
+ {
+ $relation = $this->getMock('Illuminate\Database\Eloquent\Relations\MorphToMany', array('touchIfTouching'), $this->getRelationArguments());
+ $query = m::mock('stdClass');
+ $query->shouldReceive('from')->once()->with('taggables')->andReturn($query);
+ $query->shouldReceive('insert')->once()->with(array(array('taggable_id' => 1, 'taggable_type' => get_class($relation->getParent()), 'tag_id' => 2, 'foo' => 'bar')))->andReturn(true);
+ $relation->getQuery()->shouldReceive('getQuery')->andReturn($mockQueryBuilder = m::mock('StdClass'));
+ $mockQueryBuilder->shouldReceive('newQuery')->once()->andReturn($query);
+ $relation->expects($this->once())->method('touchIfTouching');
+
+ $relation->attach(2, array('foo' => 'bar'));
+ }
+
+
+ public function testDetachRemovesPivotTableRecord()
+ {
+ $relation = $this->getMock('Illuminate\Database\Eloquent\Relations\MorphToMany', array('touchIfTouching'), $this->getRelationArguments());
+ $query = m::mock('stdClass');
+ $query->shouldReceive('from')->once()->with('taggables')->andReturn($query);
+ $query->shouldReceive('where')->once()->with('taggable_id', 1)->andReturn($query);
+ $query->shouldReceive('where')->once()->with('taggable_type', get_class($relation->getParent()))->andReturn($query);
+ $query->shouldReceive('whereIn')->once()->with('tag_id', array(1, 2, 3));
+ $query->shouldReceive('delete')->once()->andReturn(true);
+ $relation->getQuery()->shouldReceive('getQuery')->andReturn($mockQueryBuilder = m::mock('StdClass'));
+ $mockQueryBuilder->shouldReceive('newQuery')->once()->andReturn($query);
+ $relation->expects($this->once())->method('touchIfTouching');
+
+ $this->assertTrue($relation->detach(array(1, 2, 3)));
+ }
+
+
+ public function testDetachMethodClearsAllPivotRecordsWhenNoIDsAreGiven()
+ {
+ $relation = $this->getMock('Illuminate\Database\Eloquent\Relations\MorphToMany', array('touchIfTouching'), $this->getRelationArguments());
+ $query = m::mock('stdClass');
+ $query->shouldReceive('from')->once()->with('taggables')->andReturn($query);
+ $query->shouldReceive('where')->once()->with('taggable_id', 1)->andReturn($query);
+ $query->shouldReceive('where')->once()->with('taggable_type', get_class($relation->getParent()))->andReturn($query);
+ $query->shouldReceive('whereIn')->never();
+ $query->shouldReceive('delete')->once()->andReturn(true);
+ $relation->getQuery()->shouldReceive('getQuery')->andReturn($mockQueryBuilder = m::mock('StdClass'));
+ $mockQueryBuilder->shouldReceive('newQuery')->once()->andReturn($query);
+ $relation->expects($this->once())->method('touchIfTouching');
+
+ $this->assertTrue($relation->detach());
+ }
+
+
+ public function getRelation()
+ {
+ list($builder, $parent) = $this->getRelationArguments();
+
+ return new MorphToMany($builder, $parent, 'taggable', 'taggables', 'taggable_id', 'tag_id');
+ }
+
+
+ public function getRelationArguments()
+ {
+ $parent = m::mock('Illuminate\Database\Eloquent\Model');
+ $parent->shouldReceive('getKey')->andReturn(1);
+ $parent->shouldReceive('getCreatedAtColumn')->andReturn('created_at');
+ $parent->shouldReceive('getUpdatedAtColumn')->andReturn('updated_at');
+
+ $builder = m::mock('Illuminate\Database\Eloquent\Builder');
+ $related = m::mock('Illuminate\Database\Eloquent\Model');
+ $builder->shouldReceive('getModel')->andReturn($related);
+
+ $related->shouldReceive('getTable')->andReturn('tags');
+ $related->shouldReceive('getKeyName')->andReturn('id');
+
+ $builder->shouldReceive('join')->once()->with('taggables', 'tags.id', '=', 'taggables.tag_id');
+ $builder->shouldReceive('where')->once()->with('taggables.taggable_id', '=', 1);
+ $builder->shouldReceive('where')->once()->with('taggables.taggable_type', get_class($parent));
+
+ return array($builder, $parent, 'taggable', 'taggables', 'taggable_id', 'tag_id', 'relation_name');
+ }
+
+}
+
+class EloquentMorphToManyModelStub extends Illuminate\Database\Eloquent\Model {
+ protected $guarded = array();
+}
\ No newline at end of file | true |
Other | laravel | framework | 6220d74ad3c2aa64786cfaff1f7230fd3d465de6.json | Fix bug in default table. | src/Illuminate/Database/Eloquent/Model.php | @@ -657,7 +657,7 @@ public function morphToMany($related, $name, $table = null, $foreignKey = null,
// appropriate query constraint and entirely manages the hydrations.
$query = $instance->newQuery();
- $table = $table ?: str_plural($table);
+ $table = $table ?: str_plural($name);
return new MorphToMany($query, $this, $name, $table, $foreignKey, $otherKey, $caller['function']);
} | false |
Other | laravel | framework | 1a774e9446ecc0dd85fe337f7eda2c49f18345ab.json | Add resource defaults to router. | src/Illuminate/Routing/Router.php | @@ -96,6 +96,13 @@ class Router implements HttpKernelInterface, RouteFiltererInterface {
*/
public static $verbs = array('GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS');
+ /**
+ * The default actions for a resourceful controller.
+ *
+ * @var array
+ */
+ protected $resourceDefaults = array('index', 'create', 'store', 'show', 'edit', 'update', 'destroy');
+
/**
* Create a new Router instance.
*
| false |
Other | laravel | framework | 063e45ebf0e40a571a26242444c3b358115120a6.json | Fix variable casing. | src/Illuminate/Foundation/Application.php | @@ -67,7 +67,7 @@ class Application extends Container implements HttpKernelInterface, ResponsePrep
*
* @var array
*/
- protected $finishCallBacks = array();
+ protected $finishCallbacks = array();
/**
* The array of shutdown callbacks. | false |
Other | laravel | framework | e8a704cf4116feae5ac03845bad732b0e38cc1f9.json | implement httpkernelinterface on router. | src/Illuminate/Routing/Router.php | @@ -6,9 +6,11 @@
use Illuminate\Http\Response;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
+use Symfony\Component\HttpKernel\HttpKernelInterface;
+use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-class Router implements RouteFiltererInterface {
+class Router implements HttpKernelInterface, RouteFiltererInterface {
/**
* The event dispatcher instance.
@@ -1223,4 +1225,15 @@ public function setControllerDispatcher(ControllerDispatcher $dispatcher)
$this->controllerDispatcher = $dispatcher;
}
+ /**
+ * Get the response for a given request.
+ *
+ * @param \Symfony\Component\HttpFoundation\Request $request
+ * @return \Symfony\Component\HttpFoundation\Response
+ */
+ public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
+ {
+ return $this->dispatch(Request::createFromBase($request));
+ }
+
}
\ No newline at end of file | false |
Other | laravel | framework | 3271f78e85a343bde67dae5a84c79739fbe8d4be.json | extract an if check into a method. | src/Illuminate/Encryption/Encrypter.php | @@ -127,14 +127,25 @@ protected function getJsonPayload($payload)
throw new DecryptException("Invalid data.");
}
- if ($payload['mac'] !== $this->hash($payload['iv'], $payload['value']))
+ if ( ! $this->validMac($payload))
{
throw new DecryptException("MAC is invalid.");
}
return $payload;
}
+ /**
+ * Determine if the MAC for the given payload is valid.
+ *
+ * @param array $payload
+ * @return bool
+ */
+ protected function validMac(array $payload)
+ {
+ return ($payload['mac'] == $this->hash($payload['iv'], $payload['value']));
+ }
+
/**
* Create a MAC for the given value.
* | false |
Other | laravel | framework | d1275cb6c95cec22e7d9009bba26eb8eb845a75f.json | Check parameter count. | src/Illuminate/Routing/Route.php | @@ -330,6 +330,8 @@ public function bindParameters(Request $request)
*/
protected function combineMatchesWithKeys(array $matches)
{
+ if (count($this->parameterNames()) == 0) return array();
+
return array_combine($this->parameterNames(), $this->padMatches($matches));
}
| false |
Other | laravel | framework | a3c47d6209d7a0889c03c7670d499d41b5d42d94.json | Move method around. | src/Illuminate/Foundation/Application.php | @@ -135,20 +135,6 @@ protected function createRequest(Request $request = null)
return $request ?: static::onRequest('createFromGlobals');
}
- /**
- * Set the application request for the console environment.
- *
- * @return void
- */
- public function setRequestForConsoleEnvironment()
- {
- $url = $this['config']->get('app.url', 'http://localhost');
-
- $parameters = array($url, 'GET', array(), array(), array(), $_SERVER);
-
- $this->instance('request', static::onRequest('create', $parameters));
- }
-
/**
* Redirect the request if it has a trailing slash.
*
@@ -826,6 +812,20 @@ public static function requestClass($class = null)
return static::$requestClass;
}
+ /**
+ * Set the application request for the console environment.
+ *
+ * @return void
+ */
+ public function setRequestForConsoleEnvironment()
+ {
+ $url = $this['config']->get('app.url', 'http://localhost');
+
+ $parameters = array($url, 'GET', array(), array(), array(), $_SERVER);
+
+ $this->instance('request', static::onRequest('create', $parameters));
+ }
+
/**
* Call a method on the default request class.
* | false |
Other | laravel | framework | b9f235706c58ff4f1a8945b5800e3386b64b5018.json | Fix bugs in routing. | src/Illuminate/Routing/RouteCollection.php | @@ -103,7 +103,7 @@ public function match(Request $request)
*/
protected function checkForAlternateVerbs($request)
{
- $others = array_diff(Router::VERBS, array($request->getMethod()));
+ $others = array_diff(Router::$verbs, array($request->getMethod()));
// Here we will spin through all verbs except for the current request verb and
// check to see if any routes respond to them. If they do, we will return a
| true |
Other | laravel | framework | b9f235706c58ff4f1a8945b5800e3386b64b5018.json | Fix bugs in routing. | src/Illuminate/Routing/Router.php | @@ -87,6 +87,13 @@ class Router implements RouteFiltererInterface {
*/
protected $groupStack = array();
+ /**
+ * All of the verbs supported by the router.
+ *
+ * @var array
+ */
+ public static $verbs = array('GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS');
+
/**
* Create a new Router instance.
*
| true |
Other | laravel | framework | e80be6d389096a07175513c84101a4bef8c565cb.json | Fix function check. | src/Illuminate/Support/helpers.php | @@ -630,7 +630,7 @@ function object_get($object, $key, $default = null)
}
}
-if ( ! function_exists('preg_replace_array'))
+if ( ! function_exists('preg_replace_sub'))
{
/**
* Replace a given pattern with each value in the array in sequentially. | false |
Other | laravel | framework | fce4751277c823539d088add456a2f6a45bbc30b.json | Get default connection name on null reconnect. | src/Illuminate/Database/DatabaseManager.php | @@ -77,6 +77,8 @@ public function connection($name = null)
*/
public function reconnect($name = null)
{
+ $name = $name ?: $this->getDefaultConnection();
+
unset($this->connections[$name]);
return $this->connection($name);
| false |
Other | laravel | framework | 0f31f7ebf945e42f2e57e6db2a2f0a448617405a.json | Fix typo in doc block. | src/Illuminate/Auth/GenericUser.php | @@ -55,7 +55,7 @@ public function __get($key)
* Dynamically set an attribute on the user.
*
* @param string $key
- * @param mied $value
+ * @param mixed $value
* @return void
*/
public function __set($key, $value) | false |
Other | laravel | framework | e929c3bef598e242997c61f8e893a2a7f8ecb286.json | Return the array from array_set. | src/Illuminate/Support/helpers.php | @@ -339,7 +339,7 @@ function array_pull(&$array, $key)
* @param array $array
* @param string $key
* @param mixed $value
- * @return void
+ * @return array
*/
function array_set(&$array, $key, $value)
{
@@ -363,6 +363,8 @@ function array_set(&$array, $key, $value)
}
$array[array_shift($keys)] = $value;
+
+ return $array;
}
}
| false |
Other | laravel | framework | 087ecd6ece89d9038840281cc02b78c92ac7eb29.json | Fix arraying of relations. | src/Illuminate/Database/Eloquent/Model.php | @@ -1866,7 +1866,7 @@ public function relationsToArray()
// If the relation value has been set, we will set it on this attributes
// list for returning. If it was not arrayable or null, we'll not set
// the value on the array because it is some type of invalid value.
- if (isset($relation))
+ if (isset($relation) or is_null($value))
{
$attributes[$key] = $relation;
} | true |
Other | laravel | framework | 087ecd6ece89d9038840281cc02b78c92ac7eb29.json | Fix arraying of relations. | tests/Database/DatabaseEloquentModelTest.php | @@ -414,13 +414,17 @@ public function testToArray()
new EloquentModelStub(array('bar' => 'baz')), new EloquentModelStub(array('bam' => 'boom'))
)));
$model->setRelation('partner', new EloquentModelStub(array('name' => 'abby')));
+ $model->setRelation('group', null);
+ $model->setRelation('multi', new Illuminate\Database\Eloquent\Collection);
$array = $model->toArray();
$this->assertTrue(is_array($array));
$this->assertEquals('foo', $array['name']);
$this->assertEquals('baz', $array['names'][0]['bar']);
$this->assertEquals('boom', $array['names'][1]['bam']);
$this->assertEquals('abby', $array['partner']['name']);
+ $this->assertEquals(null, $array['group']);
+ $this->assertEquals(array(), $array['multi']);
$this->assertFalse(isset($array['password']));
}
| true |
Other | laravel | framework | e943b3da84ab556f0176eea73387cd14fa07933e.json | Fix bug in migration table builder. | src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php | @@ -135,9 +135,7 @@ public function repositoryExists()
{
$schema = $this->getConnection()->getSchemaBuilder();
- $prefix = $this->getConnection()->getTablePrefix();
-
- return $schema->hasTable($prefix.$this->table);
+ return $schema->hasTable($this->table);
}
/** | false |
Other | laravel | framework | 3e8cc405eb4965966bfa85af9c583dff0b8158cd.json | Change typeBoolean from tinyint to bit | src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php | @@ -343,7 +343,7 @@ protected function typeDecimal(Fluent $column)
*/
protected function typeBoolean(Fluent $column)
{
- return 'tinyint';
+ return 'bit';
}
/** | false |
Other | laravel | framework | 02b8a36cb846a12493acee332ac6019069a5ebe1.json | Fix form populating with array names | src/Illuminate/Html/FormBuilder.php | @@ -596,7 +596,7 @@ protected function getCheckedState($type, $name, $value, $checked)
switch ($type)
{
case 'checkbox':
- return $this->getCheckboxCheckedState($name, $checked);
+ return $this->getCheckboxCheckedState($name, $value, $checked);
case 'radio':
return $this->getRadioCheckedState($name, $value, $checked);
@@ -614,13 +614,17 @@ protected function getCheckedState($type, $name, $value, $checked)
* @param bool $checked
* @return bool
*/
- protected function getCheckboxCheckedState($name, $checked)
+ protected function getCheckboxCheckedState($name, $value, $checked)
{
if ( ! $this->oldInputIsEmpty() and is_null($this->old($name))) return false;
if ($this->missingOldAndModel($name)) return $checked;
- return (bool) $this->getValueAttribute($name);
+ $valueAttribute = $this->getValueAttribute($name);
+
+ if (is_array($valueAttribute)) return in_array($value, $valueAttribute);
+
+ return (bool) $valueAttribute;
}
/**
@@ -870,14 +874,14 @@ public function getValueAttribute($name, $value = null)
{
if (is_null($name)) return $value;
- if (isset($this->session) and $this->session->hasOldInput($name))
+ if ( ! is_null($this->old($name)))
{
- return $this->session->getOldInput($name);
+ return $this->old($name);
}
if ( ! is_null($value)) return $value;
- if (isset($this->model) and isset($this->model[$name]))
+ if (isset($this->model))
{
return $this->getModelValueAttribute($name);
}
@@ -893,11 +897,11 @@ protected function getModelValueAttribute($name)
{
if (is_object($this->model))
{
- return object_get($this->model, $name);
+ return object_get($this->model, $this->transformKey($name));
}
elseif (is_array($this->model))
{
- return array_get($this->model, $name);
+ return array_get($this->model, $this->transformKey($name));
}
}
@@ -911,7 +915,7 @@ public function old($name)
{
if (isset($this->session))
{
- return $this->session->getOldInput($name);
+ return $this->session->getOldInput($this->transformKey($name));
}
}
@@ -925,6 +929,17 @@ public function oldInputIsEmpty()
return (isset($this->session) and count($this->session->getOldInput()) == 0);
}
+ /**
+ * Transform key from array to dot syntax.
+ *
+ * @param string $key
+ * @return string
+ */
+ protected function transformKey($key)
+ {
+ return str_replace(array('.', '[]', '[', ']'), array('_', '', '.', ''), $key);
+ }
+
/**
* Get the session store implementation.
* | false |
Other | laravel | framework | 1553f0ca825b255ca958168f2d3a06c0cee54904.json | Add prefix to has table call for MySQL. | src/Illuminate/Database/Schema/MySqlBuilder.php | @@ -14,6 +14,8 @@ public function hasTable($table)
$database = $this->connection->getDatabaseName();
+ $table = $this->connection->getTablePrefix().$table;
+
return count($this->connection->select($sql, array($database, $table))) > 0;
}
| false |
Other | laravel | framework | 2633e1249db313062c7b6c0b30bb84130ec88dd9.json | Emulate transaction nesting. | src/Illuminate/Database/Connection.php | @@ -64,6 +64,13 @@ class Connection implements ConnectionInterface {
*/
protected $fetchMode = PDO::FETCH_ASSOC;
+ /**
+ * The number of active transasctions.
+ *
+ * @var int
+ */
+ protected $transactions = 0;
+
/**
* All of the queries run against the connection.
*
@@ -400,7 +407,7 @@ public function prepareBindings(array $bindings)
*/
public function transaction(Closure $callback)
{
- $this->pdo->beginTransaction();
+ $this->beginTransaction();
// We'll simply execute the given callback within a try / catch block
// and if we catch any exception we can rollback the transaction
@@ -409,22 +416,68 @@ public function transaction(Closure $callback)
{
$result = $callback($this);
- $this->pdo->commit();
+ $this->commit();
}
// If we catch an exception, we will roll back so nothing gets messed
// up in the database. Then we'll re-throw the exception so it can
// be handled how the developer sees fit for their applications.
catch (\Exception $e)
{
- $this->pdo->rollBack();
+ $this->rollBack();
throw $e;
}
return $result;
}
+ /**
+ * Start a new database transaction.
+ *
+ * @return void
+ */
+ public function beginTransaction()
+ {
+ ++$this->transactions;
+
+ if ($this->transactions == 1)
+ {
+ $this->pdo->beginTransaction();
+ }
+ }
+
+ /**
+ * Commit the active database transaction.
+ *
+ * @return void
+ */
+ public function commit()
+ {
+ if ($this->transactions == 1) $this->pdo->commit();
+
+ --$this->transactions;
+ }
+
+ /**
+ * Rollback the active database transaction.
+ *
+ * @return void
+ */
+ public function rollBack()
+ {
+ if ($this->transactions == 1)
+ {
+ $this->transactions = 0;
+
+ $this->pdo->rollBack();
+ }
+ else
+ {
+ --$this->transactions;
+ }
+ }
+
/**
* Execute the given callback in "dry run" mode.
* | false |
Other | laravel | framework | 1a2c340fdaa5f860c5bbd608f1c90f13811dcb46.json | Allow optional path into _path helpers. | src/Illuminate/Support/helpers.php | @@ -40,11 +40,12 @@ function app($make = null)
/**
* Get the path to the application folder.
*
+ * @param string $path
* @return string
*/
- function app_path()
+ function app_path($path = '')
{
- return app('path');
+ return app('path').($path ? '/'.$path : $path);
}
}
@@ -402,9 +403,9 @@ function asset($path, $secure = null)
*
* @return string
*/
- function base_path()
+ function base_path($path = '')
{
- return app()->make('path.base');
+ return app()->make('path.base').($path ? '/'.$path : $path);
}
}
@@ -634,9 +635,9 @@ function object_get($object, $key, $default = null)
*
* @return string
*/
- function public_path()
+ function public_path($path = '')
{
- return app()->make('path.public');
+ return app()->make('path.public').($path ? '/'.$path : $path);
}
}
@@ -722,9 +723,9 @@ function starts_with($haystack, $needle)
*
* @return string
*/
- function storage_path()
+ function storage_path($path = '')
{
- return app('path.storage');
+ return app('path.storage').($path ? '/'.$path : $path);
}
}
| false |
Other | laravel | framework | be6bcb19bcf90177cc5049419a1d2fbfe24bc5f5.json | Fix SQS ID returns. | src/Illuminate/Queue/SqsQueue.php | @@ -46,7 +46,7 @@ public function push($job, $data = '', $queue = null)
$response = $this->sqs->sendMessage(array('QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload));
- return $response->MessageId;
+ return $response->get('MessageId');
}
/**
@@ -66,7 +66,7 @@ public function later($delay, $job, $data = '', $queue = null)
'QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload, 'DelaySeconds' => $delay,
- ))->MessageId;
+ ))->get('MessageId');
}
/** | false |
Other | laravel | framework | 68f62dc9c07783ce66f354f963557da25ab14dbe.json | Make container if null is passed. | src/Illuminate/Events/Dispatcher.php | @@ -40,7 +40,7 @@ class Dispatcher {
*/
public function __construct(Container $container = null)
{
- $this->container = $container;
+ $this->container = $container ?: new Container;
}
/** | false |
Other | laravel | framework | 10c8798bdd383e02c9cfefcf823af8a36b1e7dd8.json | Return the queue IDs from the push method. | src/Illuminate/Queue/BeanstalkdQueue.php | @@ -39,13 +39,13 @@ public function __construct(Pheanstalk $pheanstalk, $default)
* @param string $job
* @param mixed $data
* @param string $queue
- * @return void
+ * @return mixed
*/
public function push($job, $data = '', $queue = null)
{
$payload = $this->createPayload($job, $data);
- $this->pheanstalk->useTube($this->getQueue($queue))->put($payload);
+ return $this->pheanstalk->useTube($this->getQueue($queue))->put($payload);
}
/**
| true |
Other | laravel | framework | 10c8798bdd383e02c9cfefcf823af8a36b1e7dd8.json | Return the queue IDs from the push method. | src/Illuminate/Queue/IronQueue.php | @@ -59,13 +59,13 @@ public function __construct(IronMQ $iron, Encrypter $crypt, Request $request, $d
* @param string $job
* @param mixed $data
* @param string $queue
- * @return void
+ * @return mixed
*/
public function push($job, $data = '', $queue = null)
{
$payload = $this->createPayload($job, $data);
- $this->iron->postMessage($this->getQueue($queue), $payload);
+ return $this->iron->postMessage($this->getQueue($queue), $payload)->id;
}
/** | true |
Other | laravel | framework | 10c8798bdd383e02c9cfefcf823af8a36b1e7dd8.json | Return the queue IDs from the push method. | src/Illuminate/Queue/QueueInterface.php | @@ -8,7 +8,7 @@ interface QueueInterface {
* @param string $job
* @param mixed $data
* @param string $queue
- * @return void
+ * @return mixed
*/
public function push($job, $data = '', $queue = null);
| true |
Other | laravel | framework | 10c8798bdd383e02c9cfefcf823af8a36b1e7dd8.json | Return the queue IDs from the push method. | src/Illuminate/Queue/SqsQueue.php | @@ -38,13 +38,15 @@ public function __construct(SqsClient $sqs, $default)
* @param string $job
* @param mixed $data
* @param string $queue
- * @return void
+ * @return mixed
*/
public function push($job, $data = '', $queue = null)
{
$payload = $this->createPayload($job, $data);
- return $this->sqs->sendMessage(array('QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload));
+ $response = $this->sqs->sendMessage(array('QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload));
+
+ return $response->MessageId;
}
/** | true |
Other | laravel | framework | 5c8fabe0ff83d325f9692b53e800cf04695f272d.json | Move some dependencies to require-dev. | src/Illuminate/Cache/composer.json | @@ -9,14 +9,14 @@
],
"require": {
"php": ">=5.3.0",
- "illuminate/database": "4.0.x",
- "illuminate/encryption": "4.0.x",
- "illuminate/filesystem": "4.0.x",
- "illuminate/redis": "4.0.x",
"illuminate/support": "4.0.x"
},
"require-dev": {
- "phpunit/phpunit": "3.7.*"
+ "phpunit/phpunit": "3.7.*",
+ "illuminate/database": "4.0.x",
+ "illuminate/encryption": "4.0.x",
+ "illuminate/filesystem": "4.0.x",
+ "illuminate/redis": "4.0.x"
},
"autoload": {
"psr-0": {"Illuminate\\Cache": ""} | false |
Other | laravel | framework | ab4fcbd01ea8a8dfdb10d02ab8e8c2fa44233d2e.json | Fix form tests. | tests/Html/FormBuilderTest.php | @@ -186,6 +186,11 @@ public function testSelect()
public function testFormCheckbox()
{
+ $this->formBuilder->setSessionStore($session = m::mock('Illuminate\Session\Store'));
+ $session->shouldReceive('getOldInput')->with('foo')->andReturn(null);
+ $session->shouldReceive('getOldInput')->andReturn(array());
+ $session->shouldReceive('hasOldInput')->andReturn(false);
+
$form1 = $this->formBuilder->input('checkbox', 'foo');
$form2 = $this->formBuilder->checkbox('foo');
$form3 = $this->formBuilder->checkbox('foo', 'foobar', true); | false |
Other | laravel | framework | 17635d183e626f8d79d27297ae7dc6026865236d.json | Fix bug with relations. | src/Illuminate/Database/Eloquent/Model.php | @@ -1924,7 +1924,7 @@ public function getAttribute($key)
if (method_exists($this, $camelKey))
{
- $relations = $this->$camelKey()->get();
+ $relations = $this->$camelKey()->getResults();
return $this->relations[$key] = $relations;
} | true |
Other | laravel | framework | 17635d183e626f8d79d27297ae7dc6026865236d.json | Fix bug with relations. | src/Illuminate/Database/Eloquent/Relations/BelongsTo.php | @@ -43,7 +43,7 @@ public function __construct(Builder $query, Model $parent, $foreignKey, $relatio
*
* @return mixed
*/
- public function get()
+ public function getResults()
{
return $this->query->first();
}
@@ -200,7 +200,7 @@ public function associate(Model $model)
*/
public function update(array $attributes)
{
- $instance = $this->get();
+ $instance = $this->getResults();
return $instance->fill($attributes)->save();
} | true |
Other | laravel | framework | 17635d183e626f8d79d27297ae7dc6026865236d.json | Fix bug with relations. | src/Illuminate/Database/Eloquent/Relations/HasMany.php | @@ -9,7 +9,7 @@ class HasMany extends HasOneOrMany {
*
* @return mixed
*/
- public function get()
+ public function getResults()
{
return $this->query->get();
} | true |
Other | laravel | framework | 17635d183e626f8d79d27297ae7dc6026865236d.json | Fix bug with relations. | src/Illuminate/Database/Eloquent/Relations/HasOne.php | @@ -9,7 +9,7 @@ class HasOne extends HasOneOrMany {
*
* @return mixed
*/
- public function get()
+ public function getResults()
{
return $this->query->first();
} | true |
Other | laravel | framework | 17635d183e626f8d79d27297ae7dc6026865236d.json | Fix bug with relations. | src/Illuminate/Database/Eloquent/Relations/MorphMany.php | @@ -9,7 +9,7 @@ class MorphMany extends MorphOneOrMany {
*
* @return mixed
*/
- public function get()
+ public function getResults()
{
return $this->query->get();
} | true |
Other | laravel | framework | 17635d183e626f8d79d27297ae7dc6026865236d.json | Fix bug with relations. | src/Illuminate/Database/Eloquent/Relations/MorphOne.php | @@ -9,7 +9,7 @@ class MorphOne extends MorphOneOrMany {
*
* @return mixed
*/
- public function get()
+ public function getResults()
{
return $this->query->first();
} | true |
Other | laravel | framework | 17635d183e626f8d79d27297ae7dc6026865236d.json | Fix bug with relations. | src/Illuminate/Database/Eloquent/Relations/Relation.php | @@ -85,7 +85,7 @@ abstract public function match(array $models, Collection $results, $relation);
*
* @return mixed
*/
- abstract public function get();
+ abstract public function getResults();
/**
* Touch all of the related models for the relationship. | true |
Other | laravel | framework | 7a0b86ff9297639e14d772b79e5d555cdbeb28c1.json | Fix typo in variable. | src/Illuminate/Html/HtmlBuilder.php | @@ -123,7 +123,7 @@ public function link($url, $title = null, $attributes = array(), $secure = null)
{
$url = $this->url->to($url, array(), $secure);
- if (is_null($title) or $title === false) $title = $uri;
+ if (is_null($title) or $title === false) $title = $url;
return '<a href="'.$url.'"'.$this->attributes($attributes).'>'.$this->entities($title).'</a>';
} | false |
Other | laravel | framework | 5f6a831bdae5eb1042e24ff033ade63a6af03afb.json | Throw exception if SQLite database doesn't exist. | src/Illuminate/Database/Connectors/SQLiteConnector.php | @@ -22,6 +22,14 @@ public function connect(array $config)
$path = realpath($config['database']);
+ // Here we'll verify that the SQLite database exists before we gooing further
+ // as the developer probably wants to know if the database exists and this
+ // SQLite driver will not throw any exception if it does not by default.
+ if ($path === false)
+ {
+ throw new \InvalidArgumentException("Database does not exist.");
+ }
+
return $this->createConnection("sqlite:{$path}", $config, $options);
}
| false |
Other | laravel | framework | d8da912905fa4da22d88e27a6e278a9dae06f31d.json | Fix a bug with JSON responses. | src/Illuminate/Http/JsonResponse.php | @@ -1,13 +1,15 @@
<?php namespace Illuminate\Http;
+use Illuminate\Support\Contracts\JsonableInterface;
+
class JsonResponse extends \Symfony\Component\HttpFoundation\JsonResponse {
/**
* {@inheritdoc}
*/
public function setData($data = array())
{
- $this->data = json_encode($data);
+ $this->data = $data instanceof JsonableInterface ? $data->toJson() : json_encode($data);
return $this->update();
} | true |
Other | laravel | framework | d8da912905fa4da22d88e27a6e278a9dae06f31d.json | Fix a bug with JSON responses. | src/Illuminate/Support/Facades/Response.php | @@ -46,11 +46,7 @@ public static function view($view, $data = array(), $status = 200, array $header
*/
public static function json($data = array(), $status = 200, array $headers = array())
{
- if ($data instanceof JsonableInterface)
- {
- $data = $data->toJson();
- }
- elseif ($data instanceof ArrayableInterface)
+ if ($data instanceof ArrayableInterface)
{
$data = $data->toArray();
} | true |
Other | laravel | framework | 4acd4185d2c672e55e24891c7c5483f987790a29.json | Use makeListener for wildcards. | src/Illuminate/Events/Dispatcher.php | @@ -73,7 +73,7 @@ public function listen($event, $listener, $priority = 0)
*/
protected function setupWildcardListen($event, $listener, $priority)
{
- $this->wildcards[$event][] = $listener;
+ $this->wildcards[$event][] = $this->makeListener($listener);
}
/** | false |
Other | laravel | framework | c1e2b9685784db268c3829e77317acd4ef6d8127.json | Fix title handling in HTML builder. | src/Illuminate/Html/HtmlBuilder.php | @@ -123,7 +123,7 @@ public function link($url, $title = null, $attributes = array(), $secure = null)
{
$url = $this->url->to($url, array(), $secure);
- $title = $title ?: $url;
+ if (is_null($title) or $title === false) $title = $uri;
return '<a href="'.$url.'"'.$this->attributes($attributes).'>'.$this->entities($title).'</a>';
} | false |
Other | laravel | framework | d6545c568dffad637e3465dea0e6745025531a45.json | Add space between lines. | src/Illuminate/Cache/Section.php | @@ -196,6 +196,7 @@ public function sectionItemKey($key)
protected function reset()
{
$this->store->forever($this->sectionKey(), $id = uniqid());
+
return $id;
}
| false |
Other | laravel | framework | d29eec6576a47566fc907e7b0adc7052ef1f3ccf.json | prevent error on flushing empty cache
Also fix problem of section returning stale data | src/Illuminate/Cache/Section.php | @@ -123,7 +123,7 @@ public function forget($key)
*/
public function flush()
{
- $this->store->increment($this->sectionKey());
+ $this->reset();
}
/**
@@ -188,6 +188,17 @@ public function sectionItemKey($key)
return $this->name.':'.$this->sectionId().':'.$key;
}
+ /**
+ * Reset the section, returning a new section identifier
+ *
+ * @return string
+ */
+ protected function reset()
+ {
+ $this->store->forever($this->sectionKey(), $id = uniqid());
+ return $id;
+ }
+
/**
* Get the unique section identifier.
*
@@ -199,7 +210,7 @@ protected function sectionId()
if (is_null($id))
{
- $this->store->forever($this->sectionKey(), $id = rand(1, 10000));
+ $id = $this->reset();
}
return $id; | false |
Other | laravel | framework | 29ec6d62a2d01eb598870e8740d3c02c404dee8f.json | Add array_column polyfill. | src/Illuminate/Foundation/changes.json | @@ -7,6 +7,7 @@
{"message": "Query elapsed time is now reported as float instead of string.", "backport": null},
{"message": "Added Model::query method for generating an empty query builder.", "backport": null},
{"message": "The @yield Blade directive now accepts a default value as the second argument.", "backport": null}
- {"message": "Fixed bug causing null to be passed to auth.logout event.", "backport": null}
+ {"message": "Fixed bug causing null to be passed to auth.logout event.", "backport": null},
+ {"message": "Added polyfill for array_column forward compatibility.", "backport": null}
]
}
\ No newline at end of file | true |
Other | laravel | framework | 29ec6d62a2d01eb598870e8740d3c02c404dee8f.json | Add array_column polyfill. | src/Illuminate/Support/helpers.php | @@ -90,6 +90,21 @@ function array_build($array, Closure $callback)
}
}
+if ( ! function_exists('array_column'))
+{
+ /**
+ * Pluck an array of values from an array.
+ *
+ * @param array $array
+ * @param string $key
+ * @return array
+ */
+ function array_column($array, $key)
+ {
+ return array_pluck($array, $key);
+ }
+}
+
if ( ! function_exists('array_divide'))
{
/** | true |
Other | laravel | framework | 98c0c3b1f25cf643a81f4e2d88ab4befc4ce6a22.json | Fix bug in Auth Guard logout method. | src/Illuminate/Auth/Guard.php | @@ -386,13 +386,21 @@ protected function createRecaller($id)
*/
public function logout()
{
+ $user = $this->user();
+
+ // If we have an event dispatcher instance, we can fire off the logout event
+ // so any further processing can be done. This allows the developer to be
+ // listening for anytime a user signs out of this application manually.
$this->clearUserDataFromStorage();
if (isset($this->events))
{
- $this->events->fire('auth.logout', array($this->user()));
+ $this->events->fire('auth.logout', array($user));
}
+ // Once we have fired the logout event we will clear the users out of memory
+ // so they are no longer available as the user is no longer considered as
+ // being signed into this application and should not be available here.
$this->user = null;
$this->loggedOut = true; | false |
Other | laravel | framework | 6cb9a0ee8ebf73838261f6c393bed7cf380ca8c8.json | Fix bug in auth.logout event. | src/Illuminate/Auth/Guard.php | @@ -390,7 +390,7 @@ public function logout()
if (isset($this->events))
{
- $this->events->fire('auth.logout', array($this->user));
+ $this->events->fire('auth.logout', array($this->user()));
}
$this->user = null; | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.