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 | b18c7258f7ae8ba3a01a41c272cbf2f7e0b75005.json | Set incremented value on model. | tests/Database/DatabaseEloquentModelTest.php | @@ -831,6 +831,25 @@ public function testReplicateCreatesANewModelInstanceWithSameAttributeValues()
}
+ public function testIncrementOnExistingModelCallsQueryAndSetsAttribute()
+ {
+ $model = m::mock('EloquentModelStub[newQuery]');
+ $model->exists = true;
+ $model->id = 1;
+ $model->syncOriginalAttribute('id... | true |
Other | laravel | framework | 07b9f6c9acb9ae0c1284aff688342c7cfd321967.json | Fix property order. | src/Illuminate/Session/Store.php | @@ -73,10 +73,10 @@ class Store implements SessionInterface {
*/
public function __construct($name, SessionHandlerInterface $handler, $id = null)
{
+ $this->setId($id);
$this->name = $name;
$this->handler = $handler;
$this->metaBag = new MetadataBag;
- $this->setId($id);
}
/** | false |
Other | laravel | framework | 66fdf12f0d9f5558f9b4274f36aa2872fd972a5a.json | Remove duplicate id check | src/Illuminate/Session/Store.php | @@ -76,7 +76,7 @@ public function __construct($name, SessionHandlerInterface $handler, $id = null)
$this->name = $name;
$this->handler = $handler;
$this->metaBag = new MetadataBag;
- $this->setId($id ?: $this->generateSessionId());
+ $this->setId($id);
}
/** | false |
Other | laravel | framework | 76e4be8628d695aa3e1e683fb32c06addf0fa28d.json | Use array_pull for session pull | src/Illuminate/Session/Store.php | @@ -276,11 +276,7 @@ public function get($name, $default = null)
*/
public function pull($key, $default = null)
{
- $value = $this->get($key, $default);
-
- $this->forget($key);
-
- return $value;
+ return array_pull($this->attributes, $key, $default);
}
/** | false |
Other | laravel | framework | c81ee6a0522fda78a12da6a0e1ef15c673dab338.json | Use cache get default value | src/Illuminate/Session/CookieSessionHandler.php | @@ -53,7 +53,7 @@ public function close()
*/
public function read($sessionId)
{
- return $this->request->cookies->get($sessionId, '');
+ return $this->request->cookies->get($sessionId) ?: '';
}
/** | false |
Other | laravel | framework | b6407420475599f997cd0102f588de3a22a1dc7b.json | Use cache get default value | src/Illuminate/Session/CacheBasedSessionHandler.php | @@ -52,7 +52,7 @@ public function close()
*/
public function read($sessionId)
{
- return $this->cache->get($sessionId) ?: '';
+ return $this->cache->get($sessionId, '');
}
/** | true |
Other | laravel | framework | b6407420475599f997cd0102f588de3a22a1dc7b.json | Use cache get default value | src/Illuminate/Session/CookieSessionHandler.php | @@ -53,7 +53,7 @@ public function close()
*/
public function read($sessionId)
{
- return $this->request->cookies->get($sessionId) ?: '';
+ return $this->request->cookies->get($sessionId, '');
}
/** | true |
Other | laravel | framework | 71647bb8b9f2a0ac9e98cde496751f52a660fb00.json | Remove useless space | src/Illuminate/Html/FormBuilder.php | @@ -719,7 +719,7 @@ public function submit($value = null, $options = array())
*/
public function button($value = null, $options = array())
{
- if ( ! array_key_exists('type', $options) )
+ if ( ! array_key_exists('type', $options))
{
$options['type'] = 'button';
} | false |
Other | laravel | framework | bf2d81458d18579443ffd2557298ef1e8aaf7fe3.json | Fix variable name | src/Illuminate/Mail/Transport/LogTransport.php | @@ -70,7 +70,7 @@ protected function getMimeEntityString(Swift_Mime_MimeEntity $entity)
foreach ($entity->getChildren() as $children)
{
- $string .= PHP_EOL.PHP_EOL.$this->getMimeEntityString($entity);
+ $string .= PHP_EOL.PHP_EOL.$this->getMimeEntityString($children);
}
return $string; | false |
Other | laravel | framework | ad5f533d1818816a366d88ab8a1f2c47931f8284.json | Add Carbon dependencies to Queue | src/Illuminate/Queue/composer.json | @@ -13,7 +13,8 @@
"illuminate/container": "4.2.*",
"illuminate/http": "4.2.*",
"illuminate/support": "4.2.*",
- "symfony/process": "2.5.*"
+ "symfony/process": "2.5.*",
+ "nesbot/carbon": "~1.0"
},
"require-dev": {
"illuminate/cache": "4.2.*", | false |
Other | laravel | framework | 691ae2fafe66f8acb404eb8325efdfba2f353675.json | Remove duplicate EOL | src/Illuminate/Auth/AuthServiceProvider.php | @@ -29,7 +29,6 @@ public function register()
});
}
-
/**
* Get the services provided by the provider.
*
| true |
Other | laravel | framework | 691ae2fafe66f8acb404eb8325efdfba2f353675.json | Remove duplicate EOL | src/Illuminate/Console/Command.php | @@ -221,7 +221,6 @@ public function askWithCompletion($question, array $choices, $default = null)
return $helper->ask($this->input, $this->output, $question);
}
-
/**
* Prompt the user for input but hide the answer from the console.
* | true |
Other | laravel | framework | 691ae2fafe66f8acb404eb8325efdfba2f353675.json | Remove duplicate EOL | src/Illuminate/Database/Connectors/PostgresConnector.php | @@ -16,7 +16,6 @@ class PostgresConnector extends Connector implements ConnectorInterface {
PDO::ATTR_STRINGIFY_FETCHES => false,
);
-
/**
* Establish a database connection.
* | true |
Other | laravel | framework | 691ae2fafe66f8acb404eb8325efdfba2f353675.json | Remove duplicate EOL | src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php | @@ -231,7 +231,6 @@ protected function typeChar(Fluent $column)
return "nchar({$column->length})";
}
-
/**
* Create the column definition for a string type.
* | true |
Other | laravel | framework | 691ae2fafe66f8acb404eb8325efdfba2f353675.json | Remove duplicate EOL | src/Illuminate/Routing/Console/MakeControllerCommand.php | @@ -160,7 +160,6 @@ protected function getArguments()
);
}
-
/**
* Get the console command options.
* | true |
Other | laravel | framework | 691ae2fafe66f8acb404eb8325efdfba2f353675.json | Remove duplicate EOL | src/Illuminate/Session/SessionManager.php | @@ -130,7 +130,6 @@ protected function createRedisDriver()
return $this->buildSession($handler);
}
-
/**
* Create an instance of a cache driven driver.
*
| true |
Other | laravel | framework | cdef186931e8137370f11ddf06ae1a5a9eb4aeab.json | Remove duplicate code | src/Illuminate/Validation/Validator.php | @@ -913,7 +913,7 @@ protected function validateIn($attribute, $value, $parameters)
*/
protected function validateNotIn($attribute, $value, $parameters)
{
- return ! in_array((string) $value, $parameters);
+ return ! $this->validateIn($attribute, $value, $parameters);
}
/**
@@ -1722,12 +1722,7 @@ protecte... | false |
Other | laravel | framework | 2d7c8c8bc29ca32c0fd474f82be3f48b97e6d153.json | Fix docblock for MetadataBag namespace | src/Illuminate/Session/Store.php | @@ -38,7 +38,7 @@ class Store implements SessionInterface {
/**
* The meta-data bag instance.
*
- * @var \Symfony\Component\Session\Storage\MetadataBag
+ * @var \Symfony\Component\HttpFoundation\Session\Storage\MetadataBag
*/
protected $metaBag;
| false |
Other | laravel | framework | 031bb63c55b685c65d99c2590e60f6d1d690584b.json | Add ability to add and remove observable events | src/Illuminate/Database/Eloquent/Model.php | @@ -1261,6 +1261,54 @@ public function getObservableEvents()
);
}
+ /**
+ * Set the observable event names.
+ *
+ * @return void
+ */
+ public function setObservableEvents(array $observables)
+ {
+ $this->observables = $observables;
+ }
+
+ /**
+ * Add an observable event name.
+ *
+ * @param mixed $ob... | true |
Other | laravel | framework | 031bb63c55b685c65d99c2590e60f6d1d690584b.json | Add ability to add and remove observable events | tests/Database/DatabaseEloquentModelTest.php | @@ -774,6 +774,32 @@ public function testModelObserversCanBeAttachedToModels()
}
+ public function testSetObservableEvents()
+ {
+ $class = new EloquentModelStub;
+ $class->setObservableEvents(array('foo'));
+
+ $this->assertContains('foo', $class->getObservableEvents());
+ }
+
+ public function testAddObserva... | true |
Other | laravel | framework | 7bac330c68a5ad23f24918d310fd55722d5f1d00.json | Fix method order. | src/Illuminate/Pagination/Paginator.php | @@ -103,8 +103,8 @@ public function __construct(Factory $factory, array $items, $total, $perPage = n
if (is_null($perPage))
{
$this->perPage = (int) $total;
- $this->items = array_slice($items, 0, $this->perPage);
$this->hasMore = count($items) > $this->perPage;
+ $this->items = array_slice($items, 0,... | false |
Other | laravel | framework | 4e5a70019d22e7415d512c3ef5df2f29bd587419.json | Fix method order. | src/Illuminate/Support/Collection.php | @@ -409,18 +409,6 @@ public function random($amount = 1)
return is_array($keys) ? array_intersect_key($this->items, array_flip($keys)) : $this->items[$keys];
}
-
- /**
- * Shuffle the items in the collection.
- *
- * @return \Illuminate\Support\Collection
- */
- public function shuffle()
- {
- s... | false |
Other | laravel | framework | 36eec89228d87667607ed25aede5b1d25a4f61de.json | Remove unneeded calls to with | src/Illuminate/Cookie/CookieServiceProvider.php | @@ -15,7 +15,7 @@ public function register()
{
$config = $app['config']['session'];
- return with(new CookieJar)->setDefaultPathAndDomain($config['path'], $config['domain']);
+ return (new CookieJar)->setDefaultPathAndDomain($config['path'], $config['domain']);
});
}
}
| true |
Other | laravel | framework | 36eec89228d87667607ed25aede5b1d25a4f61de.json | Remove unneeded calls to with | src/Illuminate/Database/Eloquent/Builder.php | @@ -111,7 +111,7 @@ public function findOrFail($id, $columns = array('*'))
{
if ( ! is_null($model = $this->find($id, $columns))) return $model;
- throw with(new ModelNotFoundException)->setModel(get_class($this->model));
+ throw (new ModelNotFoundException)->setModel(get_class($this->model));
}
/**
@@ -... | true |
Other | laravel | framework | 36eec89228d87667607ed25aede5b1d25a4f61de.json | Remove unneeded calls to with | src/Illuminate/Database/Eloquent/Model.php | @@ -594,7 +594,7 @@ protected static function firstByAttributes($attributes)
*/
public static function query()
{
- return with(new static)->newQuery();
+ return (new static)->newQuery();
}
/**
@@ -671,7 +671,7 @@ public static function findOrFail($id, $columns = array('*'))
{
if ( ! is_null($model =... | true |
Other | laravel | framework | 36eec89228d87667607ed25aede5b1d25a4f61de.json | Remove unneeded calls to with | src/Illuminate/Database/Eloquent/SoftDeletingTrait.php | @@ -110,7 +110,7 @@ public function trashed()
*/
public static function withTrashed()
{
- return with(new static)->newQueryWithoutScope(new SoftDeletingScope);
+ return (new static)->newQueryWithoutScope(new SoftDeletingScope);
}
/** | true |
Other | laravel | framework | 36eec89228d87667607ed25aede5b1d25a4f61de.json | Remove unneeded calls to with | src/Illuminate/Encryption/Encrypter.php | @@ -155,7 +155,7 @@ protected function getJsonPayload($payload)
*/
protected function validMac(array $payload)
{
- $bytes = with(new SecureRandom)->nextBytes(16);
+ $bytes = (new SecureRandom)->nextBytes(16);
$calcMac = hash_hmac('sha256', $this->hash($payload['iv'], $payload['value']), $bytes, true);
| true |
Other | laravel | framework | 36eec89228d87667607ed25aede5b1d25a4f61de.json | Remove unneeded calls to with | src/Illuminate/Foundation/Application.php | @@ -259,7 +259,7 @@ public function detectEnvironment($envs)
{
$args = isset($_SERVER['argv']) ? $_SERVER['argv'] : null;
- return $this['env'] = with(new EnvironmentDetector())->detect($envs, $args);
+ return $this['env'] = (new EnvironmentDetector())->detect($envs, $args);
}
/**
@@ -619,10 +619,10 @@ p... | true |
Other | laravel | framework | 36eec89228d87667607ed25aede5b1d25a4f61de.json | Remove unneeded calls to with | src/Illuminate/Foundation/Composer.php | @@ -79,7 +79,7 @@ protected function findComposer()
*/
protected function getProcess()
{
- return with(new Process('', $this->workingPath))->setTimeout(null);
+ return (new Process('', $this->workingPath))->setTimeout(null);
}
/** | true |
Other | laravel | framework | 36eec89228d87667607ed25aede5b1d25a4f61de.json | Remove unneeded calls to with | src/Illuminate/Http/Request.php | @@ -536,7 +536,7 @@ public static function createFromBase(SymfonyRequest $request)
{
if ($request instanceof static) return $request;
- return with(new static)->duplicate(
+ return (new static)->duplicate(
$request->query->all(), $request->request->all(), $request->attributes->all(),
| true |
Other | laravel | framework | 36eec89228d87667607ed25aede5b1d25a4f61de.json | Remove unneeded calls to with | src/Illuminate/Routing/RouteCollection.php | @@ -185,7 +185,7 @@ protected function getOtherMethodsRoute($request, array $others)
{
if ($request->method() == 'OPTIONS')
{
- return with(new Route('OPTIONS', $request->path(), function() use ($others)
+ return (new Route('OPTIONS', $request->path(), function() use ($others)
{
return new Re... | true |
Other | laravel | framework | 36eec89228d87667607ed25aede5b1d25a4f61de.json | Remove unneeded calls to with | src/Illuminate/Routing/Router.php | @@ -1188,7 +1188,7 @@ public function model($key, $class, Closure $callback = null)
// For model binders, we will attempt to retrieve the models using the find
// method on the model instance. If we cannot retrieve the models we'll
// throw a not found exception otherwise we will return the instance.
- if... | true |
Other | laravel | framework | 36eec89228d87667607ed25aede5b1d25a4f61de.json | Remove unneeded calls to with | src/Illuminate/Support/ServiceProvider.php | @@ -105,7 +105,7 @@ public function package($package, $namespace = null, $path = null)
*/
public function guessPackagePath()
{
- $path = with(new ReflectionClass($this))->getFileName();
+ $path = (new ReflectionClass($this))->getFileName();
return realpath(dirname($path).'/../../');
} | true |
Other | laravel | framework | 36eec89228d87667607ed25aede5b1d25a4f61de.json | Remove unneeded calls to with | src/Illuminate/Translation/Translator.php | @@ -145,7 +145,7 @@ protected function makeReplacements($line, array $replace)
*/
protected function sortReplacements(array $replace)
{
- return with(new Collection($replace))->sortBy(function($r)
+ return (new Collection($replace))->sortBy(function($r)
{
return mb_strlen($r) * -1;
}); | true |
Other | laravel | framework | 8fb5c0a01f757ec3345c1e570ffafc8b04fd3e98.json | use getRememberTokenName() in UserTrait | src/Illuminate/Auth/UserTrait.php | @@ -29,7 +29,7 @@ public function getAuthPassword()
*/
public function getRememberToken()
{
- return $this->remember_token;
+ return $this->{$this->getRememberTokenName()};
}
/**
@@ -40,7 +40,7 @@ public function getRememberToken()
*/
public function setRememberToken($value)
{
- $this->remember_t... | false |
Other | laravel | framework | e48f572ceec687a32c7955e69882ec5cc6539413.json | Add contains to changes | src/Illuminate/Foundation/changes.json | @@ -26,7 +26,8 @@
{"message": "Added convenient traits for authentication and password reminding.", "backport": null},
{"message": "Added 'reject' method to Collection.", "backport": null},
{"message": "Added 'updateOrCreate' method to Eloquent model.", "backport": null},
- {"message": "Added 'keyBy' method t... | false |
Other | laravel | framework | 29d0a968019bff40baccac21f6bde2f243cee083.json | Remove duplicate rows from simple pagination | src/Illuminate/Pagination/Paginator.php | @@ -103,8 +103,8 @@ public function __construct(Factory $factory, array $items, $total, $perPage = n
if (is_null($perPage))
{
$this->perPage = (int) $total;
- $this->items = array_slice($items, 0, $perPage);
- $this->hasMore = count(array_slice($items, $this->perPage, 1)) > 0;
+ $this->items = array_sli... | true |
Other | laravel | framework | 29d0a968019bff40baccac21f6bde2f243cee083.json | Remove duplicate rows from simple pagination | tests/Pagination/PaginationPaginatorTest.php | @@ -21,6 +21,29 @@ public function testPaginationContextIsSetupCorrectly()
$this->assertEquals(1, $p->getCurrentPage());
}
+ public function testSimplePagination()
+ {
+ $p = new Paginator($factory = m::mock('Illuminate\Pagination\Factory'), ['foo', 'bar', 'baz'], 2);
+ $factory->shouldReceive('getCurrentPage'... | true |
Other | laravel | framework | d17b2c1a462273606438f3a42b16747d75e8d7f1.json | Fix logic around marking services resolved or not
If you app->extend an object after it's been bound but before it's
been resolved, it will be initialized right away. The solution is
to just check if an object has actually been resolved rather than
if it's bound.
A related issue that can also be solved as a part of t... | src/Illuminate/Container/Container.php | @@ -80,6 +80,17 @@ public function bound($abstract)
return isset($this[$abstract]) || isset($this->instances[$abstract]);
}
+ /**
+ * Determine if the given abstract type has been resolved.
+ *
+ * @param string $abstract
+ * @return bool
+ */
+ public function resolved($abstract)
+ {
+ return isset($this... | true |
Other | laravel | framework | d17b2c1a462273606438f3a42b16747d75e8d7f1.json | Fix logic around marking services resolved or not
If you app->extend an object after it's been bound but before it's
been resolved, it will be initialized right away. The solution is
to just check if an object has actually been resolved rather than
if it's bound.
A related issue that can also be solved as a part of t... | src/Illuminate/Foundation/Application.php | @@ -463,6 +463,42 @@ public function make($abstract, $parameters = array())
return parent::make($abstract, $parameters);
}
+ /**
+ * Determine if the given abstract type has been bound.
+ *
+ * (Overriding Container::bound)
+ *
+ * @param string $abstract
+ * @return bool
+ */
+ public function bound($a... | true |
Other | laravel | framework | 84eacdbefe410cec9966443ed8aebbdb67861d2d.json | add Passes method to run validation | src/Illuminate/Validation/Validator.php | @@ -318,7 +318,10 @@ protected function validate($attribute, $rule)
*
* @return array
*/
- public function passed(){
+ public function passed()
+ {
+ if ( ! $this->messages) $this->passes();
+
return array_diff_key($this->data, $this->messages()->toArray());
}
| false |
Other | laravel | framework | fcb9642d475f08d462a0522eb0111d0e6963bf54.json | Remove unneeded calls to with | src/Illuminate/Database/Eloquent/Model.php | @@ -829,7 +829,7 @@ public function morphTo($name = null, $type = null, $id = null)
$instance = new $class;
return new MorphTo(
- with($instance)->newQuery(), $this, $id, $instance->getKeyName(), $type, $name
+ $instance->newQuery(), $this, $id, $instance->getKeyName(), $type, $name
);
}
}
@@ -... | true |
Other | laravel | framework | fcb9642d475f08d462a0522eb0111d0e6963bf54.json | Remove unneeded calls to with | src/Illuminate/Foundation/Console/TailCommand.php | @@ -71,7 +71,7 @@ protected function tailLocalLogs($path)
$lines = $this->option('lines');
- with(new Process('tail -f -n '.$lines.' '.escapeshellarg($path)))->setTimeout(null)->run(function($type, $line) use ($output)
+ (new Process('tail -f -n '.$lines.' '.escapeshellarg($path)))->setTimeout(null)->run(funct... | true |
Other | laravel | framework | fcb9642d475f08d462a0522eb0111d0e6963bf54.json | Remove unneeded calls to with | src/Illuminate/Foundation/Console/TinkerCommand.php | @@ -46,7 +46,7 @@ protected function runBorisShell()
{
$this->setupBorisErrorHandling();
- with(new \Boris\Boris('> '))->start();
+ (new \Boris\Boris('> '))->start();
}
/** | true |
Other | laravel | framework | 591eb4f283abe1a41b4bc73aadee17cadfbde914.json | Replace spaces with tabs | src/Illuminate/Console/ConfirmableTrait.php | @@ -22,9 +22,9 @@ public function confirmToProceed()
if ( ! $confirmed)
{
- $this->comment('Command Cancelled!');
+ $this->comment('Command Cancelled!');
- return false;
+ return false;
}
}
| false |
Other | laravel | framework | a5b876d2d4b20d1957c8661d9c01be312e7a4ef4.json | Add keyBy to changes | src/Illuminate/Foundation/changes.json | @@ -25,7 +25,8 @@
{"message": "Added --daemon option to the queue:work command.", "backport": null},
{"message": "Added convenient traits for authentication and password reminding.", "backport": null},
{"message": "Added 'reject' method to Collection.", "backport": null},
- {"message": "Added 'updateOrCreate'... | false |
Other | laravel | framework | f42a0244951ef71719839a5863847b8eadeca504.json | Use negated filter for reject | src/Illuminate/Support/Collection.php | @@ -407,31 +407,25 @@ public function reduce($callback, $initial = null)
}
/**
- * Create a colleciton of all elements that do not pass a given truth test.
+ * Create a collection of all elements that do not pass a given truth test.
*
* @param \Closure|mixed $callback
* @return \Illuminate\Sup... | false |
Other | laravel | framework | c0f90d36fd4a828eb44d01b9a7a3add89fc69231.json | Fix DocBlock and variable names | src/Illuminate/Database/Eloquent/Collection.php | @@ -73,7 +73,7 @@ public function contains($key)
* Fetch a nested element of the collection.
*
* @param string $key
- * @return \Illuminate\Support\Collection
+ * @return \Illuminate\Database\Eloquent\Collection
*/
public function fetch($key)
{
@@ -121,14 +121,14 @@ public function modelKeys()
/**... | false |
Other | laravel | framework | 773e2f20f8941f965407778345ecd4c3a33921b1.json | Fix return type. | src/Illuminate/Support/Collection.php | @@ -140,7 +140,7 @@ public function first(Closure $callback = null, $default = null)
/**
* Get a flattened array of the items in the collection.
*
- * @return array
+ * @return \Illuminate\Support\Collection
*/
public function flatten()
{
| false |
Other | laravel | framework | 0f4bcc0340a82fc9ed8592f608037c86d47de369.json | Add back array set on get. | src/Illuminate/Routing/Router.php | @@ -142,7 +142,7 @@ public function __construct(Dispatcher $events, Container $container = null)
*/
public function get($uri, $action)
{
- return $this->addRoute('GET', $uri, $action);
+ return $this->addRoute(['GET', 'HEAD'], $uri, $action);
}
/** | false |
Other | laravel | framework | b82b72bc16a48c22cc3650adc326df4e4e018729.json | Add HEAD when GET is set in Route::macth() | src/Illuminate/Routing/Route.php | @@ -680,6 +680,11 @@ public function getMethods()
*/
public function methods()
{
+ if (in_array('GET', $this->methods) && ! in_array('HEAD', $this->methods))
+ {
+ $this->methods[] = 'HEAD';
+ }
+
return $this->methods;
}
| true |
Other | laravel | framework | b82b72bc16a48c22cc3650adc326df4e4e018729.json | Add HEAD when GET is set in Route::macth() | src/Illuminate/Routing/Router.php | @@ -142,7 +142,7 @@ public function __construct(Dispatcher $events, Container $container = null)
*/
public function get($uri, $action)
{
- return $this->addRoute(array('GET', 'HEAD'), $uri, $action);
+ return $this->addRoute('GET', $uri, $action);
}
/** | true |
Other | laravel | framework | b82b72bc16a48c22cc3650adc326df4e4e018729.json | Add HEAD when GET is set in Route::macth() | tests/Routing/RoutingRouteTest.php | @@ -89,6 +89,35 @@ public function testOptionsResponsesAreGeneratedByDefault()
}
+ public function testHeadDispatcher()
+ {
+ $router = $this->getRouter();
+ $router->match(['GET', 'POST'], 'foo', function () { return 'bar'; });
+
+ $response = $router->dispatch(Request::create('foo', 'OPTIONS'));
+ ... | true |
Other | laravel | framework | edccb7c6cd8cb668b7303cdbcf73e0d0a6235d03.json | make code a little cleaner | src/Illuminate/Queue/BeanstalkdQueue.php | @@ -1,7 +1,7 @@
<?php namespace Illuminate\Queue;
-use Pheanstalk\Job as Pheanstalk_Job;
-use Pheanstalk\Pheanstalk as Pheanstalk;
+use Pheanstalk\Job as PheanstalkJob;
+use Pheanstalk\Pheanstalk;
use Illuminate\Queue\Jobs\BeanstalkdJob;
class BeanstalkdQueue extends Queue implements QueueInterface {
@@... | true |
Other | laravel | framework | edccb7c6cd8cb668b7303cdbcf73e0d0a6235d03.json | make code a little cleaner | src/Illuminate/Queue/Connectors/BeanstalkdConnector.php | @@ -1,7 +1,7 @@
<?php namespace Illuminate\Queue\Connectors;
use Illuminate\Queue\BeanstalkdQueue;
-use Pheanstalk\Pheanstalk as Pheanstalk;
+use Pheanstalk\Pheanstalk;
class BeanstalkdConnector implements ConnectorInterface {
| true |
Other | laravel | framework | 27d50a2f5548765df136ccd9bf77059bbe73d093.json | Add keyBy method to Collection | src/Illuminate/Support/Collection.php | @@ -205,6 +205,26 @@ public function groupBy($groupBy)
return new static($results);
}
+ /**
+ * Key an associative array by a field.
+ *
+ * @param string $keyBy
+ * @return \Illuminate\Support\Collection
+ */
+ public function keyBy($keyBy)
+ {
+ $results = [];
+
+ foreach ($this->items as... | true |
Other | laravel | framework | 27d50a2f5548765df136ccd9bf77059bbe73d093.json | Add keyBy method to Collection | tests/Support/SupportCollectionTest.php | @@ -368,6 +368,14 @@ public function testGroupByAttribute()
}
+ public function testKeyByAttribute()
+ {
+ $data = new Collection([['rating' => 1, 'name' => '1'], ['rating' => 2, 'name' => '2'], ['rating' => 3, 'name' => '3']]);
+ $result = $data->keyBy('rating');
+ $this->assertEquals([1 => ['rating' =... | true |
Other | laravel | framework | 469d429d62ec43d4bb8a5b88b9203e31afc17eaf.json | Remove broken community tests. | tests/Queue/QueueSqsJobTest.php | @@ -1,89 +0,0 @@
-<?php
-
-use Mockery as m;
-
-use Aws\Sqs\SqsClient;
-use Aws\Common\Credentials\Credentials;
-use Aws\Common\Credentials\CredentialsInterface;
-use Aws\Common\Signature\SignatureInterface;
-use Aws\Common\Signature\SignatureV4;
-
-use Guzzle\Common\Collection;
-use Guzzle\Service\Resource\Model;
-
-c... | true |
Other | laravel | framework | 469d429d62ec43d4bb8a5b88b9203e31afc17eaf.json | Remove broken community tests. | tests/Queue/QueueSqsQueueTest.php | @@ -1,89 +0,0 @@
-<?php
-
-use Mockery as m;
-
-use Aws\Sqs\SqsClient;
-use Guzzle\Service\Resource\Model;
-
-class QueueSqsQueueTest extends PHPUnit_Framework_TestCase {
-
- public function tearDown()
- {
- m::close();
- }
-
- public function setUp() {
-
- // Use Mockery to mock the SqsClient
- $th... | true |
Other | laravel | framework | a77c6f40a2e2aa2b5eee9d4df64b4c8625012f0e.json | Prevent a fatal error if Router->current is empty
Prevents a fatal error ("Call to a member function getAction() on a non-object") if currentRouteAction() is called and there is no current route. | src/Illuminate/Routing/Router.php | @@ -1554,6 +1554,8 @@ public function currentRouteNamed($name)
*/
public function currentRouteAction()
{
+ if (!$this->current()) return null;
+
$action = $this->current()->getAction();
return isset($action['controller']) ? $action['controller'] : null; | false |
Other | laravel | framework | 40e2cf765ba603d03f7c37c8f3edde537d4b22d6.json | Fix merge conflicts. | src/Illuminate/Http/Request.php | @@ -241,7 +241,16 @@ public function only($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
- return array_only($this->all(), $keys) + array_fill_keys($keys, null);
+ $results = [];
+
+ $input = $this->all();
+
+ foreach ($keys as $key)
+ {
+ array_set($results, $key, array_get($input, $key, nul... | true |
Other | laravel | framework | 40e2cf765ba603d03f7c37c8f3edde537d4b22d6.json | Fix merge conflicts. | tests/Http/HttpRequestTest.php | @@ -169,6 +169,10 @@ public function testOnlyMethod()
$request = Request::create('/', 'GET', array('name' => 'Taylor', 'age' => 25));
$this->assertEquals(array('age' => 25), $request->only('age'));
$this->assertEquals(array('name' => 'Taylor', 'age' => 25), $request->only('name', 'age'));
+
+ $request = Reque... | true |
Other | laravel | framework | 13a55dec52b1f6a9aeb5ec029d051e713e4ed1e7.json | Use input:all for only and except. | src/Illuminate/Http/Request.php | @@ -241,7 +241,7 @@ public function only($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
- return array_only($this->input(), $keys) + array_fill_keys($keys, null);
+ return array_only($this->all(), $keys) + array_fill_keys($keys, null);
}
/**
@@ -254,7 +254,7 @@ public function except($keys)
... | false |
Other | laravel | framework | 72ef9387185a7e6e74240e8854c623b24e056d2b.json | return null when forgetting | src/Illuminate/Cache/DatabaseStore.php | @@ -71,7 +71,9 @@ public function get($key)
if (time() >= $cache->expiration)
{
- return $this->forget($key);
+ $this->forget($key);
+
+ return null;
}
return $this->encrypter->decrypt($cache->value); | true |
Other | laravel | framework | 72ef9387185a7e6e74240e8854c623b24e056d2b.json | return null when forgetting | src/Illuminate/Cache/FileStore.php | @@ -63,7 +63,9 @@ public function get($key)
// this directory much cleaner for us as old files aren't hanging out.
if (time() >= $expire)
{
- return $this->forget($key);
+ $this->forget($key);
+
+ return null;
}
return unserialize(substr($contents, 10)); | true |
Other | laravel | framework | ebe243b596c2e56508c0ef28c6bce94abbc2b6b9.json | fix tests for PR #4766 | tests/Database/DatabaseEloquentModelTest.php | @@ -766,8 +766,8 @@ public function testCloneModelMakesAFreshCopyOfTheModel()
public function testModelObserversCanBeAttachedToModels()
{
EloquentModelStub::setEventDispatcher($events = m::mock('Illuminate\Events\Dispatcher'));
- $events->shouldReceive('listen')->once()->with('eloquent.creating: EloquentModelSt... | false |
Other | laravel | framework | 1aca4bbde671a1f25bffc9859af34eecc98002f5.json | Add comment in MySQLGrammar | src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php | @@ -11,7 +11,7 @@ class MySqlGrammar extends Grammar {
*
* @var array
*/
- protected $modifiers = array('Unsigned', 'Nullable', 'Default', 'Increment', 'After');
+ protected $modifiers = array('Unsigned', 'Nullable', 'Default', 'Increment', 'After', 'Comment');
/**
* The possible column serials
@@ -567,... | false |
Other | laravel | framework | 3ef0926153aaa9ab814c87977a1fbad66823dd50.json | Enable array_forget to unset one or many keys | src/Illuminate/Http/Request.php | @@ -256,7 +256,7 @@ public function except($keys)
$results = $this->input();
- foreach ($keys as $key) array_forget($results, $key);
+ array_forget($results, $keys);
return $results;
} | true |
Other | laravel | framework | 3ef0926153aaa9ab814c87977a1fbad66823dd50.json | Enable array_forget to unset one or many keys | src/Illuminate/Support/helpers.php | @@ -266,29 +266,30 @@ function array_flatten($array)
if ( ! function_exists('array_forget'))
{
/**
- * Remove an array item from a given array using "dot" notation.
+ * Remove one or many array items from a given array using "dot" notation.
*
- * @param array $array
- * @param string $key
+ * @param a... | true |
Other | laravel | framework | 3ef0926153aaa9ab814c87977a1fbad66823dd50.json | Enable array_forget to unset one or many keys | tests/Support/SupportHelpersTest.php | @@ -41,6 +41,12 @@ public function testArrayForget()
array_forget($array, 'names.developer');
$this->assertFalse(isset($array['names']['developer']));
$this->assertTrue(isset($array['names']['otherDeveloper']));
+
+ $array = ['names' => ['developer' => 'taylor', 'otherDeveloper' => 'dayle', 'thirdDeveloper' =... | true |
Other | laravel | framework | 388c3a81b9aed8b936e5821a6141daa619954814.json | Use cache repository. | src/Illuminate/Queue/Worker.php | @@ -2,7 +2,7 @@
use Illuminate\Queue\Jobs\Job;
use Illuminate\Events\Dispatcher;
-use Illuminate\Cache\StoreInterface;
+use Illuminate\Cache\Repository as CacheRepository;
use Illuminate\Queue\Failed\FailedJobProviderInterface;
class Worker {
@@ -28,6 +28,13 @@ class Worker {
*/
protected $events;... | false |
Other | laravel | framework | 897bb4e22986b7d9dfaa1adb890b2e59810fc9f6.json | Update typo in docblock for Worker.php
*cough* I am going to be that guy... there is a typo in your docblock, bro. =).
Targets 4.1 branch as per comment in pull request #4664 | src/Illuminate/Queue/Worker.php | @@ -7,7 +7,7 @@
class Worker {
/**
- * THe queue manager instance.
+ * The queue manager instance.
*
* @var \Illuminate\Queue\QueueManager
*/
| false |
Other | laravel | framework | 1d4265dbfb4da567943c196b4e7162002ed54bde.json | Add use ...\Str to helpers.php | src/Illuminate/Support/helpers.php | @@ -1,5 +1,7 @@
<?php
+use Illuminate\Support\Str;
+
if ( ! function_exists('action'))
{
/**
@@ -507,7 +509,7 @@ function base_path($path = '')
*/
function camel_case($value)
{
- return Illuminate\Support\Str::camel($value);
+ return Str::camel($value);
}
}
@@ -634,7 +636,7 @@ function e($value)
... | false |
Other | laravel | framework | 38f435e2aec6d03fd37c30f17a8bf126847fec3d.json | Intend $app->booted closure code | src/Illuminate/Foundation/start.php | @@ -223,49 +223,49 @@
$app->booted(function() use ($app, $env)
{
-/*
-|--------------------------------------------------------------------------
-| Load The Application Start Script
-|--------------------------------------------------------------------------
-|
-| The start scripts gives this application the oppor... | false |
Other | laravel | framework | 74c1b8027b5128026905bb9e49b7e77667b7ba34.json | Add updateOrCreate() function | src/Illuminate/Database/Eloquent/Model.php | @@ -558,6 +558,21 @@ public static function firstOrNew(array $attributes)
return new static($attributes);
}
+ /**
+ * Create or update a record matching the attributes, and fill it with values.
+ *
+ * @param array $attributes
+ * @param array $values
+ * @return \Illuminate\Database\Eloquent\Model
+ */
+ ... | false |
Other | laravel | framework | 208d1b04fab8b07f911c78de020398c9f18b9bdd.json | Fix code formatting. | src/Illuminate/Console/Command.php | @@ -63,6 +63,13 @@ public function __construct()
$this->specifyParameters();
}
+ /**
+ * Execute the console command.
+ *
+ * @return void
+ */
+ abstract public function fire();
+
/**
* Specify the arguments and options on the command.
*
@@ -382,5 +389,4 @@ public function setLaravel($laravel)
$t... | false |
Other | laravel | framework | 95aaa4de97bdddd4156b06afdad0a66196086565.json | Add boolean validation option | src/Illuminate/Validation/Validator.php | @@ -695,6 +695,20 @@ protected function validateAccepted($attribute, $value)
return ($this->validateRequired($attribute, $value) && in_array($value, $acceptable, true));
}
+ /**
+ * Validate that an attribute is a boolean.
+ *
+ * @param string $attribute
+ * @param mixed $value
+ * @... | true |
Other | laravel | framework | 95aaa4de97bdddd4156b06afdad0a66196086565.json | Add boolean validation option | tests/Validation/ValidationValidatorTest.php | @@ -460,6 +460,44 @@ public function testValidateAccepted()
}
+ public function testValidateBoolean()
+ {
+ $trans = $this->getRealTranslator();
+ $v = new Validator($trans, array('foo' => 'no'), array('foo' => 'Boolean'));
+ $this->assertFalse($v->passes());
+
+ $v = new... | true |
Other | laravel | framework | 7cd65764ae0cd6759353cb1231c421319141caf8.json | Continue loop on wildcards. | src/Illuminate/Events/Dispatcher.php | @@ -64,12 +64,14 @@ public function listen($events, $listener, $priority = 0)
{
if (str_contains($event, '*'))
{
- return $this->setupWildcardListen($event, $listener);
+ $this->setupWildcardListen($event, $listener);
}
+ else
+ {
+ $this->listeners[$event][$priority][] = $this->makeListener... | false |
Other | laravel | framework | 4ce3061980c116dd51dd5eaf07e2a163fba2e3f8.json | Fix usage of uniqid. | src/Illuminate/Session/Store.php | @@ -156,7 +156,7 @@ public function setId($id)
*/
protected function generateSessionId()
{
- return sha1(uniqid(true).str_random(25).microtime(true));
+ return sha1(uniqid('', true).str_random(25).microtime(true));
}
/** | false |
Other | laravel | framework | 8d0e7b1281fc6cfc005484547ca95a15fa1eb4e4.json | Throw DecryptException on error, for consistency | src/Illuminate/Encryption/Encrypter.php | @@ -109,7 +109,12 @@ public function decrypt($payload)
*/
protected function mcryptDecrypt($value, $iv)
{
- return mcrypt_decrypt($this->cipher, $this->key, $value, $this->mode, $iv);
+ try {
+ return mcrypt_decrypt($this->cipher, $this->key, $value, $this->mode, $iv);
+ }
+ catch (\Exception $e) {
+ thr... | false |
Other | laravel | framework | 27d42308ed3c370b943b7c9db27dd4f4eaf685a6.json | make OptimizeCommand compile views | src/Illuminate/Foundation/Console/OptimizeCommand.php | @@ -2,6 +2,7 @@
use Illuminate\Console\Command;
use Illuminate\Foundation\Composer;
+use Illuminate\View\Engines\CompilerEngine;
use ClassPreloader\Command\PreCompileCommand;
use Symfony\Component\Console\Input\InputOption;
@@ -64,6 +65,10 @@ public function fire()
$this->info('Compiling common classes');
... | true |
Other | laravel | framework | 27d42308ed3c370b943b7c9db27dd4f4eaf685a6.json | make OptimizeCommand compile views | src/Illuminate/View/Factory.php | @@ -247,7 +247,7 @@ public function renderEach($view, $data, $iterator, $empty = 'raw|')
* @param string $path
* @return \Illuminate\View\Engines\EngineInterface
*/
- protected function getEngineFromPath($path)
+ public function getEngineFromPath($path)
{
$engine = $this->extensions[$this->getExtension(... | true |
Other | laravel | framework | 1bbb6f16aa03c1de6d89ccbf4ca81bf98e1330ab.json | Increment 4.1 version. | src/Illuminate/Foundation/Application.php | @@ -27,7 +27,7 @@ class Application extends Container implements HttpKernelInterface, TerminableIn
*
* @var string
*/
- const VERSION = '4.1.29';
+ const VERSION = '4.1.30';
/**
* Indicates if the application has "booted". | false |
Other | laravel | framework | 80cc5fd606afc2afd3d89f6e1636c5fc2e0dd296.json | Remove unneeded test. | tests/Database/DatabaseQueryBuilderTest.php | @@ -736,27 +736,6 @@ public function testQuickPaginateCorrectlyCreatesPaginatorInstance()
}
- public function testGetPaginationCountGetsResultCountWithSelectDistinct()
- {
- unset($_SERVER['orders']);
- $builder = $this->getBuilder();
- $builder->getConnection()->shouldReceive('select')->once()->with('select c... | false |
Other | laravel | framework | f6106c4095f2b26833db6b600ff7ead88c2edb43.json | Remove unneeded test. | tests/Database/DatabaseQueryBuilderTest.php | @@ -718,27 +718,6 @@ public function testGetPaginationCountGetsResultCount()
}
- public function testGetPaginationCountGetsResultCountWithSelectDistinct()
- {
- unset($_SERVER['orders']);
- $builder = $this->getBuilder();
- $builder->getConnection()->shouldReceive('select')->once()->with('select count(distinct... | false |
Other | laravel | framework | 240fc43029f30bc3291673d7894b47607547ab34.json | Fix broken PR. | src/Illuminate/Database/Query/Builder.php | @@ -1558,27 +1558,13 @@ public function getPaginationCount()
{
$this->backupFieldsForCount();
- $columns = $this->columns;
-
- // We have to check if the value is "null" so that the count function does
- // not attempt to count an invalid string. Checking the value is better
- // here because the count funct... | false |
Other | laravel | framework | 3201b00272251c4878b705cddb7d49f736500880.json | Use isset instead of array_key_exists. | src/Illuminate/Database/Eloquent/Model.php | @@ -2205,7 +2205,7 @@ public function attributesToArray()
// formatting while accessing attributes vs. arraying / JSONing a model.
foreach ($this->getDates() as $key)
{
- if ( ! array_key_exists($key, $attributes)) continue;
+ if ( ! isset($attributes[$key])) continue;
$attributes[$key] = (string) $t... | false |
Other | laravel | framework | eec8a73e8ea13c7ca9a98942ec2a07aa84ffaf6d.json | fix buildSession call for database handler | src/Illuminate/Session/SessionManager.php | @@ -72,7 +72,7 @@ protected function createDatabaseDriver()
$table = $connection->getTablePrefix().$this->app['config']['session.table'];
- return $this->buildSession($connection, $table);
+ return $this->buildSession(new DatabaseSessionHandler($connection, $table));
}
/**
| false |
Other | laravel | framework | 39bcf2b439aa2966d4d5be1f53447a2347f7f4c9.json | Improve Collection extensibility
Make the only `private` method `protected` so it can be used in other implementations. | src/Illuminate/Support/Collection.php | @@ -723,7 +723,7 @@ public function __toString()
* @param \Illuminate\Support\Collection|\Illuminate\Support\Contracts\ArrayableInterface|array $items
* @return array
*/
- private function getArrayableItems($items)
+ protected function getArrayableItems($items)
{
if ($items instanceof Collection... | false |
Other | laravel | framework | 3f0269f97344deed0b7b5279d368a099837c7483.json | Limit repeated queries when token is not valid. | src/Illuminate/Auth/Guard.php | @@ -71,6 +71,13 @@ class Guard {
*/
protected $loggedOut = false;
+ /**
+ * Indicates if a token user retrieval has been attempted.
+ *
+ * @var bool
+ */
+ protected $tokenRetrievalAttempted = false;
+
/**
* Create a new authentication guard.
*
@@ -169,8 +176,10 @@ public function id()
*/
prote... | false |
Other | laravel | framework | ce9b24fd47791d2b92233e236a82f61c96f78070.json | Add array_search to Support\Collection
Add the ability to perform array_search on Support\Collection. | src/Illuminate/Support/Collection.php | @@ -376,6 +376,18 @@ public function reverse()
return new static(array_reverse($this->items));
}
+ /**
+ * Search the collection for a given item and returns the corresponding key if successful
+ *
+ * @param mixed $value
+ * @param bool $strict
+ * @return mixed
+ */
+ public function searc... | false |
Other | laravel | framework | 2a5604bdcdbcd8b533d49fe743c2efbe04ceabc1.json | Bring more in line with request::is. | src/Illuminate/Routing/Router.php | @@ -1510,12 +1510,20 @@ public function currentRouteName()
/**
* Alias for the "currentRouteNamed" method.
*
- * @param string $name
+ * @param dynamic string
* @return bool
*/
- public function is($name)
+ public function is()
{
- return $this->currentRouteNamed($name);
+ foreach (func_get_args... | false |
Other | laravel | framework | 5b0593b168d8d0422fd72320407f2e94fb71d525.json | Fix return type of docblock comment for bindIf | src/Illuminate/Container/Container.php | @@ -165,7 +165,7 @@ protected function getClosure($abstract, $concrete)
* @param string $abstract
* @param Closure|string|null $concrete
* @param bool $shared
- * @return bool
+ * @return void
*/
public function bindIf($abstract, $concrete = null, $shared = false)
{ | false |
Other | laravel | framework | 00249a5f379c2e94644bea9698a87105eeb00ca4.json | Add failing test
Signed-off-by: Daniel Bøndergaard <danielboendergaard@gmail.com> | tests/Routing/RoutingRouteTest.php | @@ -608,6 +608,20 @@ public function testMergingControllerUses()
$action = $routes[0]->getAction();
$this->assertEquals('Namespace\\Nested\\Controller', $action['controller']);
+
+
+ $router = $this->getRouter();
+ $router->group(array('prefix' => 'baz'), function() use ($router)
+ {
+ $router->gro... | false |
Other | laravel | framework | c0eaab9554bc2971d8eb92261d36944f7657349b.json | Pull makes now use of array_pull | src/Illuminate/Support/Collection.php | @@ -325,11 +325,7 @@ public function push($value)
*/
public function pull($key, $default = null)
{
- $value = $this->get($key, $default);
-
- $this->forget($key);
-
- return $value;
+ return array_pull($this->items, $key, $default);
}
/**
| false |
Other | laravel | framework | 8e96ccd6c78ca68c1d8e44f48fbab9ac0537229c.json | move remindabletrait into reminders namespace. | src/Illuminate/Auth/Reminders/RemindableTrait.php | @@ -1,4 +1,4 @@
-<?php namespace Illuminate\Auth;
+<?php namespace Illuminate\Auth\Reminders;
trait RemindableTrait {
| false |
Other | laravel | framework | 05c8aa20962f2c20f0b5013bac35f70ae6298f7e.json | add helper method for using error_log | src/Illuminate/Log/Writer.php | @@ -5,6 +5,7 @@
use Monolog\Handler\StreamHandler;
use Monolog\Logger as MonologLogger;
use Monolog\Formatter\LineFormatter;
+use Monolog\Handler\ErrorLogHandler;
use Monolog\Handler\RotatingFileHandler;
use Illuminate\Support\Contracts\JsonableInterface;
use Illuminate\Support\Contracts\ArrayableInterface;
@@ -8... | true |
Other | laravel | framework | 05c8aa20962f2c20f0b5013bac35f70ae6298f7e.json | add helper method for using error_log | tests/Log/LogWriterTest.php | @@ -27,6 +27,14 @@ public function testRotatingFileHandlerCanBeAdded()
}
+ public function testErrorLogHandlerCanBeAdded()
+ {
+ $writer = new Writer($monolog = m::mock('Monolog\Logger'));
+ $monolog->shouldReceive('pushHandler')->once()->with(m::type('Monolog\Handler\ErrorLogHandler'));
+ $writer->useErrorLog... | true |
Other | laravel | framework | ef8a2da67113ddea36f30b38646c1ad5cf52f159.json | Prepare Query Bindings for Exception
Prepare query bindings (format DateTime etc.) before passing them to Illuminate\Database\QueryException, this will prevent the "Object of class DateTime could not be converted to string" error that occurs when query errors are encountered. | src/Illuminate/Database/Connection.php | @@ -552,7 +552,7 @@ protected function run($query, $bindings, Closure $callback)
// lot more helpful to the developer instead of just the database's errors.
catch (\Exception $e)
{
- throw new QueryException($query, $bindings, $e);
+ throw new QueryException($query, $this->prepareBindings($bindings), $e);
... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.