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 | e5535493564984c7b17b524ec6a368a66038cb16.json | Fix auth contract. | src/Illuminate/Auth/Guard.php | @@ -262,19 +262,16 @@ public function validate(array $credentials = array())
* Attempt to authenticate using HTTP Basic Auth.
*
* @param string $field
- * @param \Symfony\Component\HttpFoundation\Request $request
* @return \Symfony\Component\HttpFoundation\Response|null
*/
- public function basic($field = 'email', Request $request = null)
+ public function basic($field = 'email')
{
if ($this->check()) return;
- $request = $request ?: $this->getRequest();
-
// If a username is set on the HTTP basic request, we will return out without
// interrupting the request lifecycle. Otherwise, we'll need to generate a
// request indicating that the given credentials were invalid for login.
- if ($this->attemptBasic($request, $field)) return;
+ if ($this->attemptBasic($this->getRequest(), $field)) return;
return $this->getBasicResponse();
}
@@ -283,14 +280,11 @@ public function basic($field = 'email', Request $request = null)
* Perform a stateless HTTP Basic login attempt.
*
* @param string $field
- * @param \Symfony\Component\HttpFoundation\Request $request
* @return \Symfony\Component\HttpFoundation\Response|null
*/
- public function onceBasic($field = 'email', Request $request = null)
+ public function onceBasic($field = 'email')
{
- $request = $request ?: $this->getRequest();
-
- if ( ! $this->once($this->getBasicCredentials($request, $field)))
+ if ( ! $this->once($this->getBasicCredentials($this->getRequest(), $field)))
{
return $this->getBasicResponse();
} | true |
Other | laravel | framework | e5535493564984c7b17b524ec6a368a66038cb16.json | Fix auth contract. | src/Illuminate/Contracts/Auth/Authenticator.php | @@ -34,6 +34,22 @@ public function once(array $credentials = array());
*/
public function attempt(array $credentials = array(), $remember = false, $login = true);
+ /**
+ * Attempt to authenticate using HTTP Basic Auth.
+ *
+ * @param string $field
+ * @return \Symfony\Component\HttpFoundation\Response|null
+ */
+ public function basic($field = 'email');
+
+ /**
+ * Perform a stateless HTTP Basic login attempt.
+ *
+ * @param string $field
+ * @return \Symfony\Component\HttpFoundation\Response|null
+ */
+ public function onceBasic($field = 'email');
+
/**
* Validate a user's credentials.
* | true |
Other | laravel | framework | e5535493564984c7b17b524ec6a368a66038cb16.json | Fix auth contract. | tests/Auth/AuthGuardTest.php | @@ -18,8 +18,9 @@ public function testBasicReturnsNullOnValidAttempt()
$guard->shouldReceive('check')->once()->andReturn(false);
$guard->shouldReceive('attempt')->once()->with(array('email' => 'foo@bar.com', 'password' => 'secret'))->andReturn(true);
$request = Symfony\Component\HttpFoundation\Request::create('/', 'GET', array(), array(), array(), array('PHP_AUTH_USER' => 'foo@bar.com', 'PHP_AUTH_PW' => 'secret'));
+ $guard->setRequest($request);
- $guard->basic('email', $request);
+ $guard->basic('email');
}
@@ -30,6 +31,7 @@ public function testBasicReturnsNullWhenAlreadyLoggedIn()
$guard->shouldReceive('check')->once()->andReturn(true);
$guard->shouldReceive('attempt')->never();
$request = Symfony\Component\HttpFoundation\Request::create('/', 'GET', array(), array(), array(), array('PHP_AUTH_USER' => 'foo@bar.com', 'PHP_AUTH_PW' => 'secret'));
+ $guard->setRequest($request);
$guard->basic('email', $request);
}
@@ -42,6 +44,7 @@ public function testBasicReturnsResponseOnFailure()
$guard->shouldReceive('check')->once()->andReturn(false);
$guard->shouldReceive('attempt')->once()->with(array('email' => 'foo@bar.com', 'password' => 'secret'))->andReturn(false);
$request = Symfony\Component\HttpFoundation\Request::create('/', 'GET', array(), array(), array(), array('PHP_AUTH_USER' => 'foo@bar.com', 'PHP_AUTH_PW' => 'secret'));
+ $guard->setRequest($request);
$response = $guard->basic('email', $request);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); | true |
Other | laravel | framework | 49e3c77b518547bb661b1de4fda64a3ae0c5c505.json | Allow short-cuts on generators. | src/Illuminate/Console/GeneratorCommand.php | @@ -48,7 +48,9 @@ abstract protected function getStub();
*/
public function fire()
{
- if ($this->files->exists($path = $this->getPath($name = $this->getNameInput())))
+ $name = $this->parseName($this->getNameInput());
+
+ if ($this->files->exists($path = $this->getPath($name)))
{
return $this->error($this->type.' already exists!');
}
@@ -73,6 +75,37 @@ protected function getPath($name)
return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'.php';
}
+ /**
+ * Parse the name and format according to the root namespace.
+ *
+ * @param string $name
+ * @return string
+ */
+ protected function parseName($name)
+ {
+ $rootNamespace = $this->getAppNamespace();
+
+ if (starts_with($name, $rootNamespace))
+ {
+ return $name;
+ }
+ else
+ {
+ return $this->parseName($this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name);
+ }
+ }
+
+ /**
+ * Get the default namespace for the class.
+ *
+ * @param string $rootNamespace
+ * @return string
+ */
+ protected function getDefaultNamespace($rootNamespace)
+ {
+ return $rootNamespace;
+ }
+
/**
* Build the directory for the class if necessary.
* | true |
Other | laravel | framework | 49e3c77b518547bb661b1de4fda64a3ae0c5c505.json | Allow short-cuts on generators. | src/Illuminate/Foundation/Console/ConsoleMakeCommand.php | @@ -52,6 +52,17 @@ protected function getStub()
return __DIR__.'/stubs/command.stub';
}
+ /**
+ * Get the default namespace for the class.
+ *
+ * @param string $rootNamespace
+ * @return string
+ */
+ protected function getDefaultNamespace($rootNamespace)
+ {
+ return $rootNamespace.'\Console';
+ }
+
/**
* Get the console command arguments.
* | true |
Other | laravel | framework | 49e3c77b518547bb661b1de4fda64a3ae0c5c505.json | Allow short-cuts on generators. | src/Illuminate/Foundation/Console/ProviderMakeCommand.php | @@ -37,4 +37,15 @@ protected function getStub()
return __DIR__.'/stubs/provider.stub';
}
+ /**
+ * Get the default namespace for the class.
+ *
+ * @param string $rootNamespace
+ * @return string
+ */
+ protected function getDefaultNamespace($rootNamespace)
+ {
+ return $rootNamespace.'\Providers';
+ }
+
} | true |
Other | laravel | framework | 49e3c77b518547bb661b1de4fda64a3ae0c5c505.json | Allow short-cuts on generators. | src/Illuminate/Foundation/Console/RequestMakeCommand.php | @@ -37,4 +37,15 @@ protected function getStub()
return __DIR__.'/stubs/request.stub';
}
+ /**
+ * Get the default namespace for the class.
+ *
+ * @param string $rootNamespace
+ * @return string
+ */
+ protected function getDefaultNamespace($rootNamespace)
+ {
+ return $rootNamespace.'\Http\Requests';
+ }
+
} | true |
Other | laravel | framework | 49e3c77b518547bb661b1de4fda64a3ae0c5c505.json | Allow short-cuts on generators. | src/Illuminate/Routing/Console/ControllerMakeCommand.php | @@ -44,6 +44,17 @@ protected function getStub()
}
}
+ /**
+ * Get the default namespace for the class.
+ *
+ * @param string $rootNamespace
+ * @return string
+ */
+ protected function getDefaultNamespace($rootNamespace)
+ {
+ return $rootNamespace.'\Http\Controllers';
+ }
+
/**
* Get the console command options.
* | true |
Other | laravel | framework | 49e3c77b518547bb661b1de4fda64a3ae0c5c505.json | Allow short-cuts on generators. | src/Illuminate/Routing/Console/FilterMakeCommand.php | @@ -75,6 +75,17 @@ protected function getFilterStubPath()
return __DIR__.'/stubs/filter.stub';
}
+ /**
+ * Get the default namespace for the class.
+ *
+ * @param string $rootNamespace
+ * @return string
+ */
+ protected function getDefaultNamespace($rootNamespace)
+ {
+ return $rootNamespace.'\Http\Filters';
+ }
+
/**
* Get the console command options.
* | true |
Other | laravel | framework | fc7bad49e8ecf6cf3dc70adc152e4cdbd2dc94ec.json | Remove unused path.
Signed-off-by: crynobone <crynobone@gmail.com> | src/Illuminate/Foundation/Console/AppNameCommand.php | @@ -87,7 +87,6 @@ protected function setAppDirectoryNamespace()
{
$files = Finder::create()
->in($this->laravel['path'])
- ->exclude($this->laravel['path'].'/Http/Views')
->name('*.php');
foreach ($files as $file) | false |
Other | laravel | framework | a416ceb1b77c0bfe7c86a7dbe1274f0cc53fe0ee.json | Use FQNs in the validation exception docblocks | src/Illuminate/Contracts/Validation/ValidationException.php | @@ -8,14 +8,14 @@ class ValidationException extends RuntimeException {
/**
* The message provider implementation.
*
- * @var MessageProvider
+ * @var \Illuminate\Contracts\Support\MessageProvider
*/
protected $provider;
/**
* Create a new validation exception instance.
*
- * @param MessageProvider $provider
+ * @param \Illuminate\Contracts\Support\MessageProvider $provider
* @return void
*/
public function __construct(MessageProvider $provider)
@@ -26,7 +26,7 @@ public function __construct(MessageProvider $provider)
/**
* Get the validation error message provider.
*
- * @return MessagesProvider
+ * @return \Illuminate\Contracts\Support\MessageProvider
*/
public function errors()
{
@@ -36,7 +36,7 @@ public function errors()
/**
* Get the validation error message provider.
*
- * @return MessagesProvider
+ * @return \Illuminate\Contracts\Support\MessageProvider
*/
public function getMessageProvider()
{ | false |
Other | laravel | framework | fd2c341fc1f1feef8933cf9e2054989bd6878da0.json | Fix documentation block. | src/Illuminate/Http/Request.php | @@ -601,7 +601,7 @@ public function session()
/**
* Get the user making the request.
*
- * @return \Closure
+ * @return mixed
*/
public function user()
{ | false |
Other | laravel | framework | c35c9957a276960254274929bc966ec00a0ee18f.json | Replace spaces with tabs | tests/Database/DatabaseQueryBuilderMemoryLeakTest.php | @@ -5,58 +5,58 @@
class DatabaseJoinMemoryLeakTest extends PHPUnit_Framework_TestCase {
- public function tearDown()
- {
- m::close();
- }
+ public function tearDown()
+ {
+ m::close();
+ }
- public function testItDoesNotLeakMemoryOnNewQuery()
- {
- $builderMain = $this->getBuilder();
+ public function testItDoesNotLeakMemoryOnNewQuery()
+ {
+ $builderMain = $this->getBuilder();
- $this->runMemoryTest(function() use($builderMain){
- $builder = $builderMain->newQuery();
- $builder->select('*')->from('users');
+ $this->runMemoryTest(function() use($builderMain){
+ $builder = $builderMain->newQuery();
+ $builder->select('*')->from('users');
- });
- }
+ });
+ }
- public function testItDoesNotLeakMemoryOnNewQueryWithJoin()
- {
- $builderMain = $this->getBuilder();
+ public function testItDoesNotLeakMemoryOnNewQueryWithJoin()
+ {
+ $builderMain = $this->getBuilder();
- $this->runMemoryTest(function() use($builderMain){
- $builder = $builderMain->newQuery();
- $builder->select('*')->join('new', 'col', '=', 'col2')->from('users');
+ $this->runMemoryTest(function() use($builderMain){
+ $builder = $builderMain->newQuery();
+ $builder->select('*')->join('new', 'col', '=', 'col2')->from('users');
- });
- }
+ });
+ }
- protected function runMemoryTest(\Closure $callback)
- {
- $i = 5;
+ protected function runMemoryTest(\Closure $callback)
+ {
+ $i = 5;
- $last = null;
+ $last = null;
- gc_collect_cycles();
+ gc_collect_cycles();
- while($i--)
- {
- $callback();
+ while($i--)
+ {
+ $callback();
- $prev = $last;
- $last = memory_get_usage();
- }
+ $prev = $last;
+ $last = memory_get_usage();
+ }
- $this->assertEquals($prev, $last);
- }
+ $this->assertEquals($prev, $last);
+ }
- protected function getBuilder()
- {
- $grammar = new Illuminate\Database\Query\Grammars\SqlServerGrammar;
- $processor = m::mock('Illuminate\Database\Query\Processors\Processor');
- return new Builder(m::mock('Illuminate\Database\ConnectionInterface'), $grammar, $processor);
- }
+ protected function getBuilder()
+ {
+ $grammar = new Illuminate\Database\Query\Grammars\SqlServerGrammar;
+ $processor = m::mock('Illuminate\Database\Query\Processors\Processor');
+ return new Builder(m::mock('Illuminate\Database\ConnectionInterface'), $grammar, $processor);
+ }
} | false |
Other | laravel | framework | 2439b05189292c4b9e0ae907caa4c1f9d2e5d2de.json | Collect garbage for cycles | tests/Database/DatabaseQueryBuilderMemoryLeakTest.php | @@ -38,6 +38,8 @@ protected function runMemoryTest(\Closure $callback)
$last = null;
+ gc_collect_cycles();
+
while($i--)
{
$callback(); | false |
Other | laravel | framework | 71980d06dc175170dd81a3b5e064ab1c93af12b7.json | Move getter above setter. | src/Illuminate/Http/JsonResponse.php | @@ -52,6 +52,16 @@ public function setData($data = array())
return $this->update();
}
+ /**
+ * Get the JSON encoding options.
+ *
+ * @return int
+ */
+ public function getJsonOptions()
+ {
+ return $this->jsonOptions;
+ }
+
/**
* Set the JSON encoding options.
*
@@ -65,14 +75,4 @@ public function setJsonOptions($options)
return $this->setData($this->getData());
}
- /**
- * Get the JSON encoding options.
- *
- * @return int
- */
- public function getJsonOptions()
- {
- return $this->jsonOptions;
- }
-
} | false |
Other | laravel | framework | a6661ea80527a719087af21dc015a3c1f518f556.json | fix memory leak in QueryBuilder/JoinBuilder | src/Illuminate/Database/Query/Builder.php | @@ -279,7 +279,7 @@ public function join($table, $one, $operator = null, $two = null, $type = 'inner
// one condition, so we'll add the join and call a Closure with the query.
if ($one instanceof Closure)
{
- $this->joins[] = new JoinClause($this, $type, $table);
+ $this->joins[] = new JoinClause($type, $table);
call_user_func($one, end($this->joins));
}
@@ -289,7 +289,7 @@ public function join($table, $one, $operator = null, $two = null, $type = 'inner
// this simple join clauses attached to it. There is not a join callback.
else
{
- $join = new JoinClause($this, $type, $table);
+ $join = new JoinClause($type, $table);
$this->joins[] = $join->on(
$one, $operator, $two, 'and', $where | true |
Other | laravel | framework | a6661ea80527a719087af21dc015a3c1f518f556.json | fix memory leak in QueryBuilder/JoinBuilder | src/Illuminate/Database/Query/Grammars/Grammar.php | @@ -142,6 +142,11 @@ protected function compileJoins(Builder $query, $joins)
$clauses[] = $this->compileJoinConstraint($clause);
}
+ foreach ($join->bindings as $binding)
+ {
+ $query->addBinding($binding, 'join');
+ }
+
// Once we have constructed the clauses, we'll need to take the boolean connector
// off of the first clause as it obviously will not be required on that clause
// because it leads the rest of the clauses, thus not requiring any boolean. | true |
Other | laravel | framework | a6661ea80527a719087af21dc015a3c1f518f556.json | fix memory leak in QueryBuilder/JoinBuilder | src/Illuminate/Database/Query/JoinClause.php | @@ -2,13 +2,6 @@
class JoinClause {
- /**
- * The query builder instance.
- *
- * @var \Illuminate\Database\Query\Builder
- */
- public $query;
-
/**
* The type of join being performed.
*
@@ -30,18 +23,23 @@ class JoinClause {
*/
public $clauses = array();
+ /**
+ * The "on" bindings for the join.
+ *
+ * @var array
+ */
+ public $bindings = array();
+
/**
* Create a new join clause instance.
*
- * @param \Illuminate\Database\Query\Builder $query
* @param string $type
* @param string $table
* @return void
*/
- public function __construct(Builder $query, $type, $table)
+ public function __construct($type, $table)
{
$this->type = $type;
- $this->query = $query;
$this->table = $table;
}
@@ -59,7 +57,7 @@ public function on($first, $operator, $second, $boolean = 'and', $where = false)
{
$this->clauses[] = compact('first', 'operator', 'second', 'boolean', 'where');
- if ($where) $this->query->addBinding($second, 'join');
+ if ($where) $this->bindings[] = $second;
return $this;
} | true |
Other | laravel | framework | a6661ea80527a719087af21dc015a3c1f518f556.json | fix memory leak in QueryBuilder/JoinBuilder | tests/Database/DatabaseQueryBuilderMemoryLeakTest.php | @@ -0,0 +1,60 @@
+<?php
+
+use Mockery as m;
+use Illuminate\Database\Query\Builder;
+
+class DatabaseJoinMemoryLeakTest extends PHPUnit_Framework_TestCase {
+
+ public function tearDown()
+ {
+ m::close();
+ }
+
+ public function testItDoesNotLeakMemoryOnNewQuery()
+ {
+ $builderMain = $this->getBuilder();
+
+ $this->runMemoryTest(function() use($builderMain){
+ $builder = $builderMain->newQuery();
+ $builder->select('*')->from('users');
+
+ });
+ }
+
+ public function testItDoesNotLeakMemoryOnNewQueryWithJoin()
+ {
+ $builderMain = $this->getBuilder();
+
+ $this->runMemoryTest(function() use($builderMain){
+ $builder = $builderMain->newQuery();
+ $builder->select('*')->join('new', 'col', '=', 'col2')->from('users');
+
+ });
+ }
+
+ protected function runMemoryTest(\Closure $callback)
+ {
+ $i = 5;
+
+ $last = null;
+
+ while($i--)
+ {
+ $callback();
+
+ $prev = $last;
+ $last = memory_get_usage();
+ }
+
+ $this->assertEquals($prev, $last);
+ }
+
+
+ protected function getBuilder()
+ {
+ $grammar = new Illuminate\Database\Query\Grammars\SqlServerGrammar;
+ $processor = m::mock('Illuminate\Database\Query\Processors\Processor');
+ return new Builder(m::mock('Illuminate\Database\ConnectionInterface'), $grammar, $processor);
+ }
+
+} | true |
Other | laravel | framework | 623b3209cb995aa76c9ee8c273d8345e5a0dbc42.json | Remove extra newlines | tests/Database/DatabaseEloquentModelTest.php | @@ -917,7 +917,6 @@ public function testRelationshipTouchOwnersIsPropagated()
$mockPartnerModel->shouldReceive('touchOwners')->once();
$model->setRelation('partner', $mockPartnerModel);
-
$model->touchOwners();
}
@@ -932,10 +931,8 @@ public function testRelationshipTouchOwnersIsNotPropagatedIfNoRelationshipResult
$model->shouldReceive('partner')->once()->andReturn($relation);
$model->setTouchedRelations(['partner']);
-
$model->setRelation('partner', null);
-
$model->touchOwners();
}
| false |
Other | laravel | framework | cfbdfa0a0c39e60adeae2041b9c2e48065d4158e.json | Add JSONP function to reponse facade | src/Illuminate/Support/Facades/Response.php | @@ -60,6 +60,21 @@ public static function json($data = array(), $status = 200, array $headers = arr
return new JsonResponse($data, $status, $headers, $options);
}
+ /**
+ * Return a new JSONP response from the application.
+ *
+ * @param string $callback
+ * @param string|array $data
+ * @param int $status
+ * @param array $headers
+ * @param int $options
+ * @return \Illuminate\Http\JsonResponse
+ */
+ public static function jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0)
+ {
+ return static::json($data, $status, $headers, $options)->setCallback($callback);
+ }
+
/**
* Return a new streamed response from the application.
* | false |
Other | laravel | framework | 0fd87284daff20f4d674a2498e266ce5fc832f50.json | Add getJsonOptions to JsonResponse | src/Illuminate/Http/JsonResponse.php | @@ -65,4 +65,14 @@ public function setJsonOptions($options)
return $this->setData($this->getData());
}
+ /**
+ * Get the JSON encoding options.
+ *
+ * @return int
+ */
+ public function getJsonOptions()
+ {
+ return $this->jsonOptions;
+ }
+
} | true |
Other | laravel | framework | 0fd87284daff20f4d674a2498e266ce5fc832f50.json | Add getJsonOptions to JsonResponse | tests/Http/HttpJsonResponseTest.php | @@ -10,4 +10,11 @@ public function testSetAndRetrieveData()
$this->assertEquals('bar', $data->foo);
}
+ public function testSetAndRetrieveOptions()
+ {
+ $response = new Illuminate\Http\JsonResponse(['foo' => 'bar']);
+ $response->setJsonOptions(JSON_PRETTY_PRINT);
+ $this->assertSame(JSON_PRETTY_PRINT, $response->getJsonOptions());
+ }
+
} | true |
Other | laravel | framework | bdff3a702892ff84008599a3e4502ed0abbdf62f.json | Fix redirectToAction method | src/Illuminate/Routing/ResponseFactory.php | @@ -160,7 +160,7 @@ public function redirectToRoute($route, $parameters = array(), $status = 302, $h
*/
public function redirectToAction($action, $parameters = array(), $status = 302, $headers = array())
{
- return $this->redirector->action($route, $parameters, $status, $headers);
+ return $this->redirector->action($action, $parameters, $status, $headers);
}
/** | false |
Other | laravel | framework | ffc947ae339ce7e66eecdfb2f2d1bc197ba6b356.json | Remove useless $app arguments in bindShared | src/Illuminate/Auth/Reminders/ReminderServiceProvider.php | @@ -94,7 +94,7 @@ protected function registerCommands()
return new RemindersTableCommand($app['files']);
});
- $this->app->bindShared('command.auth.reminders.clear', function($app)
+ $this->app->bindShared('command.auth.reminders.clear', function()
{
return new ClearRemindersCommand;
}); | true |
Other | laravel | framework | ffc947ae339ce7e66eecdfb2f2d1bc197ba6b356.json | Remove useless $app arguments in bindShared | src/Illuminate/Database/MigrationServiceProvider.php | @@ -145,7 +145,7 @@ protected function registerResetCommand()
*/
protected function registerRefreshCommand()
{
- $this->app->bindShared('command.migrate.refresh', function($app)
+ $this->app->bindShared('command.migrate.refresh', function()
{
return new RefreshCommand;
});
| true |
Other | laravel | framework | ffc947ae339ce7e66eecdfb2f2d1bc197ba6b356.json | Remove useless $app arguments in bindShared | src/Illuminate/Database/SeedServiceProvider.php | @@ -21,7 +21,7 @@ public function register()
{
$this->registerSeedCommand();
- $this->app->bindShared('seeder', function($app)
+ $this->app->bindShared('seeder', function()
{
return new Seeder;
});
| true |
Other | laravel | framework | ffc947ae339ce7e66eecdfb2f2d1bc197ba6b356.json | Remove useless $app arguments in bindShared | src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php | @@ -27,17 +27,17 @@ public function register()
return new Artisan($app);
});
- $this->app->bindShared('command.tail', function($app)
+ $this->app->bindShared('command.tail', function()
{
return new TailCommand;
});
- $this->app->bindShared('command.changes', function($app)
+ $this->app->bindShared('command.changes', function()
{
return new ChangesCommand;
});
- $this->app->bindShared('command.environment', function($app)
+ $this->app->bindShared('command.environment', function()
{
return new EnvironmentCommand;
}); | true |
Other | laravel | framework | ffc947ae339ce7e66eecdfb2f2d1bc197ba6b356.json | Remove useless $app arguments in bindShared | src/Illuminate/Foundation/Providers/MaintenanceServiceProvider.php | @@ -20,12 +20,12 @@ class MaintenanceServiceProvider extends ServiceProvider {
*/
public function register()
{
- $this->app->bindShared('command.up', function($app)
+ $this->app->bindShared('command.up', function()
{
return new UpCommand;
});
- $this->app->bindShared('command.down', function($app)
+ $this->app->bindShared('command.down', function()
{
return new DownCommand;
}); | true |
Other | laravel | framework | ffc947ae339ce7e66eecdfb2f2d1bc197ba6b356.json | Remove useless $app arguments in bindShared | src/Illuminate/Foundation/Providers/PublisherServiceProvider.php | @@ -173,7 +173,7 @@ protected function registerMigrationPublisher()
*/
protected function registerMigratePublishCommand()
{
- $this->app->bindShared('command.migrate.publish', function($app)
+ $this->app->bindShared('command.migrate.publish', function()
{
return new MigratePublishCommand;
}); | true |
Other | laravel | framework | ffc947ae339ce7e66eecdfb2f2d1bc197ba6b356.json | Remove useless $app arguments in bindShared | src/Illuminate/Queue/FailConsoleServiceProvider.php | @@ -23,22 +23,22 @@ class FailConsoleServiceProvider extends ServiceProvider {
*/
public function register()
{
- $this->app->bindShared('command.queue.failed', function($app)
+ $this->app->bindShared('command.queue.failed', function()
{
return new ListFailedCommand;
});
- $this->app->bindShared('command.queue.retry', function($app)
+ $this->app->bindShared('command.queue.retry', function()
{
return new RetryCommand;
});
- $this->app->bindShared('command.queue.forget', function($app)
+ $this->app->bindShared('command.queue.forget', function()
{
return new ForgetFailedCommand;
});
- $this->app->bindShared('command.queue.flush', function($app)
+ $this->app->bindShared('command.queue.flush', function()
{
return new FlushFailedCommand;
}); | true |
Other | laravel | framework | ffc947ae339ce7e66eecdfb2f2d1bc197ba6b356.json | Remove useless $app arguments in bindShared | src/Illuminate/Queue/QueueServiceProvider.php | @@ -131,7 +131,7 @@ protected function registerListenCommand()
*/
public function registerRestartCommand()
{
- $this->app->bindShared('command.queue.restart', function($app)
+ $this->app->bindShared('command.queue.restart', function()
{
return new RestartCommand;
});
@@ -146,7 +146,7 @@ public function registerRestartCommand()
*/
protected function registerSubscriber()
{
- $this->app->bindShared('command.queue.subscribe', function($app)
+ $this->app->bindShared('command.queue.subscribe', function()
{
return new SubscribeCommand;
});
| true |
Other | laravel | framework | ffc947ae339ce7e66eecdfb2f2d1bc197ba6b356.json | Remove useless $app arguments in bindShared | src/Illuminate/View/ViewServiceProvider.php | @@ -35,7 +35,7 @@ public function register()
*/
public function registerEngineResolver()
{
- $this->app->bindShared('view.engine.resolver', function($app)
+ $this->app->bindShared('view.engine.resolver', function()
{
$resolver = new EngineResolver;
| true |
Other | laravel | framework | 79506f3b7d550afbc1c13972b997f06b7f5c75e8.json | Set the user resolver on form requests. | src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php | @@ -59,6 +59,8 @@ protected function initializeRequest(FormRequest $form, Request $current)
$current->query->all(), $current->request->all(), $current->attributes->all(),
$current->cookies->all(), $files, $current->server->all(), $current->getContent()
);
+
+ $form->setUserResolver($current->getUserResolver());
}
} | true |
Other | laravel | framework | 79506f3b7d550afbc1c13972b997f06b7f5c75e8.json | Set the user resolver on form requests. | src/Illuminate/Http/Request.php | @@ -590,15 +590,27 @@ public function session()
return $this->getSession();
}
+ /**
+ * Get the user resolver callback.
+ *
+ * @return \Closure
+ */
+ public function getUserResolver()
+ {
+ return $this->userResolver ?: function() {};
+ }
+
/**
* Set the user resolver callback.
*
* @param \Closure $callback
- * @return void
+ * @return $this
*/
public function setUserResolver(Closure $callback)
{
$this->userResolver = $callback;
+
+ return $this;
}
/** | true |
Other | laravel | framework | 3b83f3cf7209757f93f6fe466a056975b43615fa.json | Add another method to auth contract. | src/Illuminate/Contracts/Auth/Authenticator.php | @@ -51,6 +51,15 @@ public function validate(array $credentials = array());
*/
public function login(User $user, $remember = false);
+ /**
+ * Log the given user ID into the application.
+ *
+ * @param mixed $id
+ * @param bool $remember
+ * @return \Illuminate\Contracts\Auth\User
+ */
+ public function loginUsingId($id, $remember = false);
+
/**
* Determine if the user was authenticated via "remember me" cookie.
* | false |
Other | laravel | framework | 89de045a17eec307837c351eaa58922cac1b3db8.json | Resolve the authenticated user out of the IoC. | src/Illuminate/Auth/AuthServiceProvider.php | @@ -18,6 +18,8 @@ class AuthServiceProvider extends ServiceProvider {
*/
public function register()
{
+ $this->registerUserResolver();
+
$this->app->bindShared('auth', function($app)
{
// Once the authentication service has actually been requested by the developer
@@ -34,14 +36,27 @@ public function register()
});
}
+ /**
+ * Register a resolver for the authenticated user.
+ *
+ * @return void
+ */
+ protected function registerUserResolver()
+ {
+ $this->app->bind('Illuminate\Contracts\Auth\User', function($app)
+ {
+ return $app['auth']->user();
+ });
+ }
+
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
- return ['auth', 'auth.driver'];
+ return ['auth', 'auth.driver', 'Illuminate\Contracts\Auth\User'];
}
}
| false |
Other | laravel | framework | b0d5a2b44d171038f9621e1d3aaffa222d36dcef.json | Add viaRemember to authenticator contract. | src/Illuminate/Contracts/Auth/Authenticator.php | @@ -51,6 +51,13 @@ public function validate(array $credentials = array());
*/
public function login(User $user, $remember = false);
+ /**
+ * Determine if the user was authenticated via "remember me" cookie.
+ *
+ * @return bool
+ */
+ public function viaRemember();
+
/**
* Log the user out of the application.
* | false |
Other | laravel | framework | 42cca80f61eeae40396bc7c47ff694f70ebf90a1.json | Add name() method to view contract. | src/Illuminate/Contracts/View/View.php | @@ -4,6 +4,13 @@
interface View extends Renderable {
+ /**
+ * Get the name of the view.
+ *
+ * @return string
+ */
+ public function name();
+
/**
* Add a piece of data to the view.
* | true |
Other | laravel | framework | 42cca80f61eeae40396bc7c47ff694f70ebf90a1.json | Add name() method to view contract. | src/Illuminate/View/View.php | @@ -229,6 +229,16 @@ public function getEngine()
return $this->engine;
}
+ /**
+ * Get the name of the view.
+ *
+ * @return string
+ */
+ public function name()
+ {
+ return $this->getName();
+ }
+
/**
* Get the name of the view.
* | true |
Other | laravel | framework | af4c7782b7b16e07ed5a7a2a86c689bebad2740a.json | Fix formatMessage docblock | src/Illuminate/Log/Writer.php | @@ -269,7 +269,7 @@ protected function fireLogEvent($level, $message, array $context = array())
/**
* Format the parameters for the logger.
*
- * @param mixed $parameters
+ * @param mixed $message
* @return void
*/
protected function formatMessage($message) | false |
Other | laravel | framework | eff8fbec1f4da86c382bb7501f72f64cd8cb198b.json | Return factory if no arguments are given. | src/Illuminate/Foundation/helpers.php | @@ -464,8 +464,17 @@ function url($path = null, $parameters = array(), $secure = null)
* @param array $mergeData
* @return \Illuminate\View\View
*/
- function view($view, $data = array(), $mergeData = array())
+ function view($view = null, $data = array(), $mergeData = array())
{
- return app('Illuminate\Contracts\View\Factory')->make($view, $data, $mergeData);
+ $factory = app('Illuminate\Contracts\View\Factory');
+
+ if (func_num_args() === 0)
+ {
+ return $factory;
+ }
+ else
+ {
+ return $factory->make($view, $data, $mergeData);
+ }
}
} | false |
Other | laravel | framework | 45bd699fd8a37148bc5a9dfbebce722b4d17d436.json | Fix validator docblock | src/Illuminate/Validation/Validator.php | @@ -1153,7 +1153,7 @@ protected function validateImage($attribute, $value)
* Validate the MIME type of a file upload attribute is in a set of MIME types.
*
* @param string $attribute
- * @param array $value
+ * @param mixed $value
* @param array $parameters
* @return bool
*/ | false |
Other | laravel | framework | 7074b9bdf341ab3136caa7afab019111edd9323a.json | Return cookie factory instance if name is null. | src/Illuminate/Foundation/helpers.php | @@ -140,9 +140,18 @@ function config($key, $default = null)
* @param bool $httpOnly
* @return \Symfony\Component\HttpFoundation\Cookie
*/
- function cookie($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true)
+ function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true)
{
- return app('Illuminate\Contracts\Cookie\Factory')->make($name, $value, $minutes, $path, $domain, $secure, $httpOnly);
+ $cookie = app('Illuminate\Contracts\Cookie\Factory');
+
+ if (is_null($name))
+ {
+ return $cookie;
+ }
+ else
+ {
+ return $cookie->make($name, $value, $minutes, $path, $domain, $secure, $httpOnly);
+ }
}
}
| false |
Other | laravel | framework | c8257cd9daad692a35087d8e22629f1c32bd1045.json | Add cookie helper. | src/Illuminate/Foundation/helpers.php | @@ -126,6 +126,26 @@ function config($key, $default = null)
}
}
+if ( ! function_exists('cookie'))
+{
+ /**
+ * Create a new cookie instance.
+ *
+ * @param string $name
+ * @param string $value
+ * @param int $minutes
+ * @param string $path
+ * @param string $domain
+ * @param bool $secure
+ * @param bool $httpOnly
+ * @return \Symfony\Component\HttpFoundation\Cookie
+ */
+ function cookie($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true)
+ {
+ return app('Illuminate\Contracts\Cookie\Factory')->make($name, $value, $minutes, $path, $domain, $secure, $httpOnly);
+ }
+}
+
if ( ! function_exists('csrf_token'))
{
/** | false |
Other | laravel | framework | e63c63f6e3aa26ba0a977191749ca7c76d56b5eb.json | Remove unused code | src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php | @@ -157,8 +157,6 @@ public function compileDropColumn(Blueprint $blueprint, Fluent $command)
*/
public function compileDropPrimary(Blueprint $blueprint, Fluent $command)
{
- $table = $blueprint->getTable();
-
$table = $this->wrapTable($blueprint);
return "alter table {$table} drop constraint {$command->index}"; | false |
Other | laravel | framework | 414a97e1f63fa1f574a7b2d89ce582633f5cdec0.json | Add carbon to optimize file. | src/Illuminate/Foundation/Console/Optimize/config.php | @@ -156,4 +156,5 @@
$basePath.'/vendor/symfony/security-core/Symfony/Component/Security/Core/Util/StringUtils.php',
$basePath.'/vendor/symfony/security-core/Symfony/Component/Security/Core/Util/SecureRandomInterface.php',
$basePath.'/vendor/symfony/security-core/Symfony/Component/Security/Core/Util/SecureRandom.php',
+ $basePath.'/vendor/nesbot/carbon/src/Carbon/Carbon.php',
)); | false |
Other | laravel | framework | 153072d99fa223f1efe3e32d6196e11426bc39a9.json | Add more files to optimize file. | src/Illuminate/Foundation/Console/Optimize/config.php | @@ -7,6 +7,8 @@
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Container/ContextualBindingBuilder.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/Renderable.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/ResponsePreparer.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Logging/Log.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Exception/Handler.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Config/Repository.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Url/Generator.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Events/Dispatcher.php',
@@ -15,8 +17,11 @@
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Cookie/Factory.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Cookie/QueueingFactory.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Encryption/Encrypter.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Queue/QueueableEntity.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/Registrar.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/ResponseFactory.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/UrlGenerator.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/UrlRoutable.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/View/Factory.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/MessageProvider.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/MessageBag.php',
@@ -42,6 +47,7 @@
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/AcceptHeader.php',
$basePath.'/vendor/symfony/debug/Symfony/Component/Debug/ExceptionHandler.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Support/AggregateServiceProvider.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Exception/ExceptionServiceProvider.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php', | false |
Other | laravel | framework | 4c0db5dd3f76e740c0635260b8f2d446988a33b5.json | Remove old test. | tests/Support/SupportFacadeResponseTest.php | @@ -1,23 +0,0 @@
-<?php
-
-use Mockery as m;
-use Illuminate\Support\Facades\Response;
-
-class SupportFacadeResponseTest extends PHPUnit_Framework_TestCase {
-
- public function tearDown()
- {
- m::close();
- }
-
-
- public function testArrayableSendAsJson()
- {
- $data = m::mock('Illuminate\Contracts\Support\Arrayable');
- $data->shouldReceive('toArray')->andReturn(array('foo' => 'bar'));
-
- $response = Response::json($data);
- $this->assertEquals('{"foo":"bar"}', $response->getContent());
- }
-
-} | false |
Other | laravel | framework | 63104317ff69db2b28c7b0ac62bb6443e5ff488e.json | Use macro-able trait. | src/Illuminate/Routing/ResponseFactory.php | @@ -12,6 +12,8 @@
class ResponseFactory implements FactoryContract {
+ use MacroableTrait;
+
/**
* The view factory implementation.
* | false |
Other | laravel | framework | b43ba4f4277f7a1fb9a2544e290b0b994ab9f57b.json | Add response helper. | src/Illuminate/Foundation/helpers.php | @@ -257,6 +257,22 @@ function redirect($to = null, $status = 302)
}
}
+if ( ! function_exists('response'))
+{
+ /**
+ * Return a new response from the application.
+ *
+ * @param string $content
+ * @param int $status
+ * @param array $headers
+ * @return \Symfony\Component\HttpFoundation\Response
+ */
+ function response($content = '', $status = 200, array $headers = array())
+ {
+ return app('Illuminate\Contracts\Routing\ResponseFactory')->make($content, $status, $headers);
+ }
+}
+
if ( ! function_exists('route'))
{
/** | false |
Other | laravel | framework | 986f9d6026b6712b1411558288d73f2af7d8e1f9.json | Add group to router contract. | src/Illuminate/Contracts/Routing/Registrar.php | @@ -1,5 +1,7 @@
<?php namespace Illuminate\Contracts\Routing;
+use Closure;
+
interface Registrar {
/**
@@ -76,6 +78,15 @@ public function match($methods, $uri, $action);
*/
public function resource($name, $controller, array $options = array());
+ /**
+ * Create a route group with shared attributes.
+ *
+ * @param array $attributes
+ * @param \Closure $callback
+ * @return void
+ */
+ public function group(array $attributes, Closure $callback);
+
/**
* Register a new "before" filter with the router.
* | false |
Other | laravel | framework | d08dc59aa0eb1d19ce9cd936a58da32d609dbfbe.json | Interface the queue factory. | src/Illuminate/Contracts/Queue/Factory.php | @@ -0,0 +1,13 @@
+<?php namespace Illuminate\Contracts\Queue;
+
+interface Factory {
+
+ /**
+ * Resolve a queue connection instance.
+ *
+ * @param string $name
+ * @return \Illuminate\Contracts\Queue\Queue
+ */
+ public function connection($name = null);
+
+} | true |
Other | laravel | framework | d08dc59aa0eb1d19ce9cd936a58da32d609dbfbe.json | Interface the queue factory. | src/Illuminate/Foundation/Application.php | @@ -1159,7 +1159,7 @@ public function registerCoreContainerAliases()
'mailer' => ['Illuminate\Mail\Mailer', 'Illuminate\Contracts\Mail\Mailer', 'Illuminate\Contracts\Mail\MailQueue'],
'paginator' => 'Illuminate\Pagination\Factory',
'auth.reminder' => ['Illuminate\Auth\Reminders\PasswordBroker', 'Illuminate\Contracts\Auth\PasswordBroker'],
- 'queue' => 'Illuminate\Queue\QueueManager',
+ 'queue' => ['Illuminate\Queue\QueueManager', 'Illuminate\Contracts\Queue\Factory'],
'queue.connection' => 'Illuminate\Contracts\Queue\Queue',
'redirect' => 'Illuminate\Routing\Redirector',
'redis' => ['Illuminate\Redis\Database', 'Illuminate\Contracts\Redis\Database'], | true |
Other | laravel | framework | d08dc59aa0eb1d19ce9cd936a58da32d609dbfbe.json | Interface the queue factory. | src/Illuminate/Queue/QueueManager.php | @@ -1,8 +1,9 @@
<?php namespace Illuminate\Queue;
use Closure;
+use Illuminate\Contracts\Queue\Factory as FactoryContract;
-class QueueManager {
+class QueueManager implements FactoryContract {
/**
* The application instance.
| true |
Other | laravel | framework | 6443ace8febb26e529af840a81bcbf673aa69bcf.json | Add environment to app contract. | src/Illuminate/Contracts/Foundation/Application.php | @@ -4,6 +4,14 @@
interface Application extends Container {
+ /**
+ * Get or check the current application environment.
+ *
+ * @param mixed
+ * @return string
+ */
+ public function environment();
+
/**
* Register a service provider with the application.
* | false |
Other | laravel | framework | 06ba7ddb4511e893dfae145df6fb67c22e3a6974.json | Rename a few contracts. | src/Illuminate/Cache/Repository.php | @@ -5,7 +5,7 @@
use ArrayAccess;
use Carbon\Carbon;
use Illuminate\Support\Traits\MacroableTrait;
-use Illuminate\Contracts\Cache\Cache as CacheContract;
+use Illuminate\Contracts\Cache\Repository as CacheContract;
class Repository implements CacheContract, ArrayAccess {
| true |
Other | laravel | framework | 06ba7ddb4511e893dfae145df6fb67c22e3a6974.json | Rename a few contracts. | src/Illuminate/Config/Repository.php | @@ -3,7 +3,7 @@
use Closure;
use ArrayAccess;
use Illuminate\Support\NamespacedItemResolver;
-use Illuminate\Contracts\Config\Config as ConfigContract;
+use Illuminate\Contracts\Config\Repository as ConfigContract;
class Repository extends NamespacedItemResolver implements ArrayAccess, ConfigContract {
| true |
Other | laravel | framework | 06ba7ddb4511e893dfae145df6fb67c22e3a6974.json | Rename a few contracts. | src/Illuminate/Contracts/Cache/Repository.php | @@ -2,7 +2,7 @@
use Closure;
-interface Cache {
+interface Repository {
/**
* Determine if an item exists in the cache. | true |
Other | laravel | framework | 06ba7ddb4511e893dfae145df6fb67c22e3a6974.json | Rename a few contracts. | src/Illuminate/Contracts/Config/Repository.php | @@ -1,6 +1,6 @@
<?php namespace Illuminate\Contracts\Config;
-interface Config {
+interface Repository {
/**
* Determine if the given configuration value exists. | true |
Other | laravel | framework | 06ba7ddb4511e893dfae145df6fb67c22e3a6974.json | Rename a few contracts. | src/Illuminate/Foundation/Application.php | @@ -1142,8 +1142,8 @@ public function registerCoreContainerAliases()
'auth.reminder.repository' => 'Illuminate\Auth\Reminders\ReminderRepositoryInterface',
'blade.compiler' => 'Illuminate\View\Compilers\BladeCompiler',
'cache' => ['Illuminate\Cache\CacheManager', 'Illuminate\Contracts\Cache\Factory'],
- 'cache.store' => ['Illuminate\Cache\Repository', 'Illuminate\Contracts\Cache\Cache'],
- 'config' => ['Illuminate\Config\Repository', 'Illuminate\Contracts\Config\Config'],
+ 'cache.store' => ['Illuminate\Cache\Repository', 'Illuminate\Contracts\Cache\Repository'],
+ 'config' => ['Illuminate\Config\Repository', 'Illuminate\Contracts\Config\Repository'],
'cookie' => ['Illuminate\Cookie\CookieJar', 'Illuminate\Contracts\Cookie\Factory', 'Illuminate\Contracts\Cookie\QueueingFactory'],
'exception' => 'Illuminate\Contracts\Exception\Handler',
'encrypter' => ['Illuminate\Encryption\Encrypter', 'Illuminate\Contracts\Encryption\Encrypter'], | true |
Other | laravel | framework | 06ba7ddb4511e893dfae145df6fb67c22e3a6974.json | Rename a few contracts. | src/Illuminate/Queue/Worker.php | @@ -2,8 +2,8 @@
use Illuminate\Contracts\Queue\Job;
use Illuminate\Contracts\Events\Dispatcher;
-use Illuminate\Contracts\Cache\Cache as CacheContract;
use Illuminate\Queue\Failed\FailedJobProviderInterface;
+use Illuminate\Contracts\Cache\Repository as CacheContract;
class Worker {
@@ -31,7 +31,7 @@ class Worker {
/**
* The cache repository implementation.
*
- * @var \Illuminate\Contracts\Cache\Cache
+ * @var \Illuminate\Contracts\Cache\Repository
*/
protected $cache;
@@ -330,7 +330,7 @@ public function setDaemonExceptionHandler($handler)
/**
* Set the cache repository implementation.
*
- * @param \Illuminate\Contracts\Cache\Cache $cache
+ * @param \Illuminate\Contracts\Cache\Repository $cache
* @return void
*/
public function setCache(CacheContract $cache)
| true |
Other | laravel | framework | 06ba7ddb4511e893dfae145df6fb67c22e3a6974.json | Rename a few contracts. | src/Illuminate/Session/CacheBasedSessionHandler.php | @@ -1,13 +1,13 @@
<?php namespace Illuminate\Session;
-use Illuminate\Contracts\Cache\Cache as CacheContract;
+use Illuminate\Contracts\Cache\Repository as CacheContract;
class CacheBasedSessionHandler implements \SessionHandlerInterface {
/**
* The cache repository instance.
*
- * @var \Illuminate\Contracts\Cache\Cache
+ * @var \Illuminate\Contracts\Cache\Repository
*/
protected $cache;
@@ -21,7 +21,7 @@ class CacheBasedSessionHandler implements \SessionHandlerInterface {
/**
* Create a new cache driven handler instance.
*
- * @param \Illuminate\Contracts\Cache\Cache $cache
+ * @param \Illuminate\Contracts\Cache\Repository $cache
* @param int $minutes
* @return void
*/
@@ -82,7 +82,7 @@ public function gc($lifetime)
/**
* Get the underlying cache repository.
*
- * @return \Illuminate\Contracts\Cache\Cache
+ * @return \Illuminate\Contracts\Cache\Repository
*/
public function getCache()
{ | true |
Other | laravel | framework | 4d2ffeef8d27980f556b7ad51c2cc68e039e5064.json | Add status to redirect helper. | src/Illuminate/Foundation/helpers.php | @@ -241,13 +241,14 @@ function public_path($path = '')
* Get an instance of the redirector.
*
* @param string|null $to
+ * @param int $status
* @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
*/
- function redirect($to = null)
+ function redirect($to = null, $status = 302)
{
if ( ! is_null($to))
{
- return app('redirect')->to($to);
+ return app('redirect')->to($to, $status);
}
else
{ | false |
Other | laravel | framework | 99656b83641a7b8e83c852a1af4bf72a2d9dcd27.json | Remove forgotten method | src/Illuminate/Session/SessionServiceProvider.php | @@ -62,14 +62,4 @@ protected function registerSessionDriver()
});
}
- /**
- * Get the session driver name.
- *
- * @return string
- */
- protected function getDriver()
- {
- return $this->app['config']['session.driver'];
- }
-
}
| false |
Other | laravel | framework | ed4068a725b8f05dc5bfad09afd6aac1b06861c7.json | Remove duplicate unset() | src/Illuminate/Container/Container.php | @@ -764,9 +764,7 @@ public function getBindings()
*/
protected function dropStaleInstances($abstract)
{
- unset($this->instances[$abstract]);
-
- unset($this->aliases[$abstract]);
+ unset($this->instances[$abstract], $this->aliases[$abstract]);
}
/**
@@ -843,9 +841,7 @@ public function offsetSet($key, $value)
*/
public function offsetUnset($key)
{
- unset($this->bindings[$key]);
-
- unset($this->instances[$key]);
+ unset($this->bindings[$key], $this->instances[$key]);
}
/** | true |
Other | laravel | framework | ed4068a725b8f05dc5bfad09afd6aac1b06861c7.json | Remove duplicate unset() | src/Illuminate/Events/Dispatcher.php | @@ -332,9 +332,7 @@ public function createClassListener($listener)
*/
public function forget($event)
{
- unset($this->listeners[$event]);
-
- unset($this->sorted[$event]);
+ unset($this->listeners[$event], $this->sorted[$event]);
}
} | true |
Other | laravel | framework | b5c0e040b406696b137f681c1defd25ea0e2a89a.json | Initialize array in SQLiteGrammar.php | src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php | @@ -148,6 +148,8 @@ public function compileAdd(Blueprint $blueprint, Fluent $command)
$columns = $this->prefixArray('add column', $this->getColumns($blueprint));
+ $statements = array();
+
foreach ($columns as $column)
{
$statements[] = 'alter table '.$table.' '.$column; | false |
Other | laravel | framework | cfc6f403be3bcc190c3dfee907bd5e72c2615d0e.json | Remove useless else with throw | src/Illuminate/Container/Container.php | @@ -618,10 +618,8 @@ protected function resolveClass(ReflectionParameter $parameter)
{
return $parameter->getDefaultValue();
}
- else
- {
- throw $e;
- }
+
+ throw $e;
}
}
| false |
Other | laravel | framework | 8a3726385171855986a6f9e1e30b09d796dfea3c.json | Extract method for if check. | src/Illuminate/Validation/Validator.php | @@ -1159,17 +1159,27 @@ protected function validateImage($attribute, $value)
*/
protected function validateMimes($attribute, $value, $parameters)
{
- if ( ! $value instanceof File || ($value instanceof UploadedFile && ! $value->isValid()))
+ if ( ! $this->isAValidFileInstance($value))
{
return false;
}
- // The Symfony File class should do a decent job of guessing the extension
- // based on the true MIME type so we'll just loop through the array of
- // extensions and compare it to the guessed extension of the files.
return $value->getPath() != '' && in_array($value->guessExtension(), $parameters);
}
+ /**
+ * Check that the given value is a valid file instnace.
+ *
+ * @param mixed $value
+ * @return bool
+ */
+ protected function isAValidFileInstance($value)
+ {
+ if ($value instanceof UploadedFile && ! $value->isValid()) return false;
+
+ return $value instanceof File;
+ }
+
/**
* Validate that an attribute contains only alphabetic characters.
* | false |
Other | laravel | framework | 818c78f44c66422a0721b206a7c95b56d8af8c78.json | Fix artisan cache:table | src/Illuminate/Cache/Console/CacheTableCommand.php | @@ -64,7 +64,7 @@ protected function createBaseMigration()
{
$name = 'create_cache_table';
- $path = $this->laravel['path'].'/database/migrations';
+ $path = $this->laravel['path.database'].'/migrations';
return $this->laravel['migration.creator']->create($name, $path);
} | false |
Other | laravel | framework | 3d4cfbcfc0f1f06b3127504761ddd5b418f0d29a.json | Remove route dependency from url generator API. | src/Illuminate/Contracts/Routing/UrlGenerator.php | @@ -36,19 +36,18 @@ public function asset($path, $secure = null);
* @param string $name
* @param mixed $parameters
* @param bool $absolute
- * @param \Illuminate\Routing\Route $route
* @return string
*
* @throws \InvalidArgumentException
*/
- public function route($name, $parameters = array(), $absolute = true, $route = null);
+ public function route($name, $parameters = array(), $absolute = true);
/**
* Get the URL to a controller action.
*
* @param string $action
- * @param mixed $parameters
- * @param bool $absolute
+ * @param mixed $parameters
+ * @param bool $absolute
* @return string
*/
public function action($action, $parameters = array(), $absolute = true); | true |
Other | laravel | framework | 3d4cfbcfc0f1f06b3127504761ddd5b418f0d29a.json | Remove route dependency from url generator API. | src/Illuminate/Routing/UrlGenerator.php | @@ -225,18 +225,13 @@ public function forceSchema($schema)
* @param string $name
* @param mixed $parameters
* @param bool $absolute
- * @param \Illuminate\Routing\Route $route
* @return string
*
* @throws \InvalidArgumentException
*/
- public function route($name, $parameters = array(), $absolute = true, $route = null)
+ public function route($name, $parameters = array(), $absolute = true)
{
- $route = $route ?: $this->routes->getByName($name);
-
- $parameters = $this->formatParameters($parameters);
-
- if ( ! is_null($route))
+ if ( ! is_null($route = $this->routes->getByName($name)))
{
return $this->toRoute($route, $parameters, $absolute);
}
@@ -256,6 +251,8 @@ public function route($name, $parameters = array(), $absolute = true, $route = n
*/
protected function toRoute($route, array $parameters, $absolute)
{
+ $parameters = $this->formatParameters($parameters);
+
$domain = $this->getRouteDomain($route, $parameters);
$uri = strtr(rawurlencode($this->trimUrl(
@@ -504,7 +501,7 @@ public function action($action, $parameters = array(), $absolute = true)
$action = trim($action, '\\');
}
- return $this->route($action, $parameters, $absolute, $this->routes->getByAction($action));
+ return $this->toRoute($this->routes->getByAction($action), $parameters, $absolute);
}
/**
| true |
Other | laravel | framework | 8f4f971ce14818bad3dde9f04efb3f38772f6d90.json | Add share() method to view factory contract. | src/Illuminate/Contracts/View/Factory.php | @@ -19,6 +19,15 @@ public function exists($view);
* @return \Illuminate\Contracts\View\View
*/
public function make($view, $data = array(), $mergeData = array());
+
+ /**
+ * Add a piece of shared data to the environment.
+ *
+ * @param string $key
+ * @param mixed $value
+ * @return void
+ */
+ public function share($key, $value = null)
/**
* Register a view composer event. | false |
Other | laravel | framework | 672d6f8b8aec7f4231777667906c8405d8b25e83.json | Define contract for message bag. | src/Illuminate/Contracts/Support/MessageBag.php | @@ -0,0 +1,99 @@
+<?php namespace Illuminate\Contracts\Support;
+
+interface MessageBag {
+
+ /**
+ * Get the keys present in the message bag.
+ *
+ * @return array
+ */
+ public function keys();
+
+ /**
+ * Add a message to the bag.
+ *
+ * @param string $key
+ * @param string $message
+ * @return $this
+ */
+ public function add($key, $message);
+
+ /**
+ * Merge a new array of messages into the bag.
+ *
+ * @param \Illuminate\Contracts\Support\MessageProvider|array $messages
+ * @return $this
+ */
+ public function merge($messages);
+
+ /**
+ * Determine if messages exist for a given key.
+ *
+ * @param string $key
+ * @return bool
+ */
+ public function has($key = null);
+
+ /**
+ * Get the first message from the bag for a given key.
+ *
+ * @param string $key
+ * @param string $format
+ * @return string
+ */
+ public function first($key = null, $format = null);
+
+ /**
+ * Get all of the messages from the bag for a given key.
+ *
+ * @param string $key
+ * @param string $format
+ * @return array
+ */
+ public function get($key, $format = null);
+
+ /**
+ * Get all of the messages for every key in the bag.
+ *
+ * @param string $format
+ * @return array
+ */
+ public function all($format = null);
+
+ /**
+ * Get the default message format.
+ *
+ * @return string
+ */
+ public function getFormat();
+
+ /**
+ * Set the default message format.
+ *
+ * @param string $format
+ * @return $this
+ */
+ public function setFormat($format = ':message');
+
+ /**
+ * Determine if the message bag has any messages.
+ *
+ * @return bool
+ */
+ public function isEmpty();
+
+ /**
+ * Get the number of messages in the container.
+ *
+ * @return int
+ */
+ public function count();
+
+ /**
+ * Get the instance as an array.
+ *
+ * @return array
+ */
+ public function toArray();
+
+} | true |
Other | laravel | framework | 672d6f8b8aec7f4231777667906c8405d8b25e83.json | Define contract for message bag. | src/Illuminate/Foundation/Console/Optimize/config.php | @@ -19,6 +19,7 @@
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/Registrar.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/View/Factory.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/MessageProvider.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/MessageBag.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/View/View.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Container/Container.php',
$basePath.'/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php', | true |
Other | laravel | framework | 672d6f8b8aec7f4231777667906c8405d8b25e83.json | Define contract for message bag. | src/Illuminate/Support/MessageBag.php | @@ -5,8 +5,9 @@
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\MessageProvider;
+use Illuminate\Contracts\Support\MessageBag as MessageBagContract;
-class MessageBag implements Arrayable, Countable, Jsonable, MessageProvider, JsonSerializable {
+class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, MessageBagContract, MessageProvider {
/**
* All of the registered messages.
| true |
Other | laravel | framework | 8529ee504f8caf7abd3776e62a3029c1ea437e82.json | Use container call. | src/Illuminate/Routing/RouteServiceProvider.php | @@ -12,7 +12,7 @@ class RouteServiceProvider extends ServiceProvider {
*/
public function boot()
{
- $this->before();
+ $this->app->call([$this, 'before']);
if ($this->app->routesAreCached())
{
@@ -23,7 +23,7 @@ public function boot()
}
else
{
- $this->map();
+ $this->app->call([$this, 'map']);
}
}
@@ -34,22 +34,6 @@ public function boot()
*/
public function register() {}
- /**
- * Called before routes are registered.
- *
- * Register any model bindings or pattern based filters.
- *
- * @return void
- */
- public function before() {}
-
- /**
- * Define the routes for the application.
- *
- * @return void
- */
- public function map() {}
-
/**
* Register the given Closure with the "group" function namespace set.
* | false |
Other | laravel | framework | a257956a80298a0b8f533eb68bfd790ae9c3cecc.json | Fix some docblocks in IronJob | src/Illuminate/Queue/Jobs/IronJob.php | @@ -15,7 +15,7 @@ class IronJob extends Job {
/**
* The IronMQ message instance.
*
- * @var array
+ * @var object
*/
protected $job;
| false |
Other | laravel | framework | 53ee4fa0dbe028fe91d1ec93d1196f2cb635b6e1.json | Fix some docblocks | src/Illuminate/Routing/UrlGenerator.php | @@ -100,7 +100,7 @@ public function previous()
*
* @param string $path
* @param mixed $extra
- * @param bool $secure
+ * @param bool|null $secure
* @return string
*/
public function to($path, $extra = array(), $secure = null)
@@ -140,7 +140,7 @@ public function secure($path, $parameters = array())
* Generate a URL to an application asset.
*
* @param string $path
- * @param bool $secure
+ * @param bool|null $secure
* @return string
*/
public function asset($path, $secure = null)
@@ -182,7 +182,7 @@ public function secureAsset($path)
/**
* Get the scheme for a raw URL.
*
- * @param bool $secure
+ * @param bool|null $secure
* @return string
*/
protected function getScheme($secure)
| false |
Other | laravel | framework | 7e200965988cd77530a99d7de369cb7f9b8a2cda.json | Add missing getTime function in Job class | src/Illuminate/Queue/Jobs/Job.php | @@ -148,6 +148,16 @@ protected function getSeconds($delay)
}
}
+ /**
+ * Get the current system time.
+ *
+ * @return int
+ */
+ protected function getTime()
+ {
+ return time();
+ }
+
/**
* Get the name of the queued job class.
*
| false |
Other | laravel | framework | 49f640d45aea98cd838fd90e962a91e7e5d49022.json | Add type in GeneratorCommand | src/Illuminate/Console/GeneratorCommand.php | @@ -19,6 +19,13 @@ abstract class GeneratorCommand extends Command {
*/
protected $configKey = '';
+ /**
+ * The type of class being generated.
+ *
+ * @var string
+ */
+ protected $type;
+
/**
* Create a new controller creator command instance.
* | false |
Other | laravel | framework | 4ea441ea82bac647ed802ab96bf4ec841bffadb1.json | Fix artisan queue:failed-table
Not going to include a failing test as it'd just be a waste of time.
Running `php artisan queue:failed-table` spits out "... failed to open stream: No such file or directory".
I guess this is left over from before /database was moved out of /app. | src/Illuminate/Queue/Console/FailedTableCommand.php | @@ -62,7 +62,7 @@ protected function createBaseMigration()
{
$name = 'create_failed_jobs_table';
- $path = $this->laravel['path'].'/database/migrations';
+ $path = $this->laravel['path.database'].'/migrations';
return $this->laravel['migration.creator']->create($name, $path);
} | false |
Other | laravel | framework | df04c420a2bc89d233a4f72f75fb53b07702e165.json | Add validation contracts. | src/Illuminate/Contracts/Validation/Factory.php | @@ -0,0 +1,16 @@
+<?php namespace Illuminate\Contracts\Validation;
+
+interface Factory {
+
+ /**
+ * Create a new Validator instance.
+ *
+ * @param array $data
+ * @param array $rules
+ * @param array $messages
+ * @param array $customAttributes
+ * @return \Illuminate\Contracts\Validation\Validator
+ */
+ public function make(array $data, array $rules, array $messages = array(), array $customAttributes = array());
+
+} | true |
Other | laravel | framework | df04c420a2bc89d233a4f72f75fb53b07702e165.json | Add validation contracts. | src/Illuminate/Contracts/Validation/Validator.php | @@ -0,0 +1,39 @@
+<?php namespace Illuminate\Contracts\Validation;
+
+use Illuminate\Contracts\Support\MessageProvider;
+
+interface Validator extends MessageProvider {
+
+ /**
+ * Determine if the data fails the validation rules.
+ *
+ * @return bool
+ */
+ public function fails();
+
+ /**
+ * Get the failed validation rules.
+ *
+ * @return array
+ */
+ public function failed();
+
+ /**
+ * Add conditions to a given field based on a Closure.
+ *
+ * @param string $attribute
+ * @param string|array $rules
+ * @param callable $callback
+ * @return void
+ */
+ public function sometimes($attribute, $rules, callable $callback);
+
+ /**
+ * After an after validation callback.
+ *
+ * @param callable|string $callback
+ * @return $this
+ */
+ public function after($callback);
+
+} | true |
Other | laravel | framework | df04c420a2bc89d233a4f72f75fb53b07702e165.json | Add validation contracts. | src/Illuminate/Foundation/Application.php | @@ -1170,7 +1170,7 @@ public function registerCoreContainerAliases()
'session' => 'Illuminate\Session\SessionManager',
'session.store' => ['Illuminate\Session\Store', 'Symfony\Component\HttpFoundation\Session\SessionInterface'],
'url' => ['Illuminate\Routing\UrlGenerator', 'Illuminate\Contracts\Routing\UrlGenerator'],
- 'validator' => 'Illuminate\Validation\Factory',
+ 'validator' => ['Illuminate\Validation\Factory', 'Illuminate\Contracts\Validation\Factory'],
'view' => ['Illuminate\View\Factory', 'Illuminate\Contracts\View\Factory'],
);
| true |
Other | laravel | framework | df04c420a2bc89d233a4f72f75fb53b07702e165.json | Add validation contracts. | src/Illuminate/Validation/Factory.php | @@ -3,8 +3,9 @@
use Closure;
use Illuminate\Container\Container;
use Symfony\Component\Translation\TranslatorInterface;
+use Illuminate\Contracts\Validation\Factory as FactoryContract;
-class Factory {
+class Factory implements FactoryContract {
/**
* The Translator implementation. | true |
Other | laravel | framework | df04c420a2bc89d233a4f72f75fb53b07702e165.json | Add validation contracts. | src/Illuminate/Validation/Validator.php | @@ -7,11 +7,11 @@
use Illuminate\Support\MessageBag;
use Illuminate\Container\Container;
use Symfony\Component\HttpFoundation\File\File;
-use Illuminate\Contracts\Support\MessageProvider;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\HttpFoundation\File\UploadedFile;
+use Illuminate\Contracts\Validation\Validator as ValidatorContract;
-class Validator implements MessageProvider {
+class Validator implements ValidatorContract {
/**
* The Translator implementation. | true |
Other | laravel | framework | df04c420a2bc89d233a4f72f75fb53b07702e165.json | Add validation contracts. | src/Illuminate/Validation/composer.json | @@ -10,6 +10,7 @@
"require": {
"php": ">=5.4.0",
"illuminate/container": "5.0.*",
+ "illuminate/contracts": "5.0.*",
"illuminate/support": "5.0.*",
"symfony/http-foundation": "2.6.*",
"symfony/translation": "2.6.*" | true |
Other | laravel | framework | 960d499924dfd8ee4b3889498246a37a6600725c.json | Add SVG to image validation rule | src/Illuminate/Validation/Validator.php | @@ -1163,7 +1163,7 @@ protected function validateActiveUrl($attribute, $value)
*/
protected function validateImage($attribute, $value)
{
- return $this->validateMimes($attribute, $value, array('jpeg', 'png', 'gif', 'bmp'));
+ return $this->validateMimes($attribute, $value, array('jpeg', 'png', 'gif', 'bmp', 'svg'));
}
/** | true |
Other | laravel | framework | 960d499924dfd8ee4b3889498246a37a6600725c.json | Add SVG to image validation rule | tests/Validation/ValidationValidatorTest.php | @@ -982,6 +982,11 @@ public function testValidateImage()
$file5->expects($this->any())->method('guessExtension')->will($this->returnValue('png'));
$v->setFiles(array('x' => $file5));
$this->assertTrue($v->passes());
+
+ $file6 = $this->getMock('Symfony\Component\HttpFoundation\File\UploadedFile', array('guessExtension'), $uploadedFile);
+ $file6->expects($this->any())->method('guessExtension')->will($this->returnValue('svg'));
+ $v->setFiles(array('x' => $file6));
+ $this->assertTrue($v->passes());
}
| true |
Other | laravel | framework | 21aa5cc1eb2eed1fa13ed240ff936a79f398b2d1.json | Remove unused loop variable. | src/Illuminate/Support/MessageBag.php | @@ -167,7 +167,7 @@ protected function transform($messages, $format, $messageKey)
// We will simply spin through the given messages and transform each one
// replacing the :message place holder with the real message allowing
// the messages to be easily formatted to each developer's desires.
- foreach ($messages as $key => &$message)
+ foreach ($messages as &$message)
{
$replace = array(':message', ':key');
| false |
Other | laravel | framework | fa9109343bc1710e6323a263330e202b78112383.json | Revert a change to a symfony version constraint | src/Illuminate/Workbench/composer.json | @@ -11,7 +11,7 @@
"php": ">=5.4.0",
"illuminate/filesystem": "~5.0",
"illuminate/support": "~5.0",
- "symfony/finder": "~2.3"
+ "symfony/finder": "2.6.*"
},
"require-dev": {
"illuminate/console": "~5.0" | false |
Other | laravel | framework | be101265c08aaeec3d6dbea8d7e04adb587000c9.json | Add router to aliases. | src/Illuminate/Foundation/Application.php | @@ -1166,7 +1166,7 @@ public function registerCoreContainerAliases()
'redirect' => 'Illuminate\Routing\Redirector',
'redis' => ['Illuminate\Redis\Database', 'Illuminate\Contracts\Redis\Database'],
'request' => 'Illuminate\Http\Request',
- 'router' => 'Illuminate\Routing\Router',
+ 'router' => ['Illuminate\Routing\Router', 'Illuminate\Contracts\Routing\Registrar'],
'session' => 'Illuminate\Session\SessionManager',
'session.store' => ['Illuminate\Session\Store', 'Symfony\Component\HttpFoundation\Session\SessionInterface'],
'url' => ['Illuminate\Routing\UrlGenerator', 'Illuminate\Contracts\Routing\UrlGenerator'], | false |
Other | laravel | framework | 01d5d7465ee5975352b953cbe63131612b1a0d27.json | Add keys method to MessageBag. | src/Illuminate/Support/MessageBag.php | @@ -36,6 +36,16 @@ public function __construct(array $messages = array())
}
}
+ /**
+ * Get the keys present in the message bag.
+ *
+ * @return array
+ */
+ public function keys()
+ {
+ return array_keys($this->messages);
+ }
+
/**
* Add a message to the bag.
*
| false |
Other | laravel | framework | 3928c224e16b85b49a7fa68b9d2e77c049a8fe1b.json | Remove some bindings. | src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php | @@ -73,7 +73,7 @@ public function register()
}
$this->commands(
- 'command.changes', 'command.environment', 'command.event.cache',
+ 'command.changes', 'command.environment',
'command.route.cache', 'command.route.clear', 'command.route.list',
'command.request.make', 'command.tinker', 'command.console.make',
'command.key.generate', 'command.down', 'command.up', 'command.clear-compiled',
@@ -298,7 +298,7 @@ public function provides()
{
return [
'artisan', 'command.changes', 'command.environment',
- 'command.event.cache', 'command.route.cache', 'command.route.clear',
+ 'command.route.cache', 'command.route.clear',
'command.route.list', 'command.request.make', 'command.tinker',
'command.console.make', 'command.key.generate', 'command.down',
'command.up', 'command.clear-compiled', 'command.optimize', | false |
Other | laravel | framework | 7b06179ebab9ab506ea6fe41a18c5214c0869e32.json | Remove event cache command. | src/Illuminate/Foundation/Application.php | @@ -764,26 +764,6 @@ public function getRouteCachePath()
return $this['path.storage'].'/meta/routes.php';
}
- /**
- * Determine if the application events are cached.
- *
- * @return bool
- */
- public function eventsAreCached()
- {
- return $this['files']->exists($this->getEventCachePath());
- }
-
- /**
- * Get the path to the events cache file.
- *
- * @return string
- */
- public function getEventCachePath()
- {
- return $this['path.storage'].'/meta/events.php';
- }
-
/**
* Handle the given request and get the response.
* | true |
Other | laravel | framework | 7b06179ebab9ab506ea6fe41a18c5214c0869e32.json | Remove event cache command. | src/Illuminate/Foundation/Console/EventCacheCommand.php | @@ -1,62 +0,0 @@
-<?php namespace Illuminate\Foundation\Console;
-
-use Illuminate\Console\Command;
-use Illuminate\Foundation\EventCache;
-use Illuminate\Filesystem\Filesystem;
-use Illuminate\Filesystem\ClassFinder;
-
-class EventCacheCommand extends Command {
-
- /**
- * The console command name.
- *
- * @var string
- */
- protected $name = 'event:cache';
-
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = 'Create a cache file of all @hears annotation events';
-
- /**
- * The filesystem instance.
- *
- * @var \Illuminate\Filesystem\Filesystem
- */
- protected $files;
-
- /**
- * Create a new event cache command instance.
- *
- * @param \Illuminate\Filesystem\Filesystem $files
- * @return void
- */
- public function __construct(Filesystem $files)
- {
- parent::__construct();
-
- $this->files = $files;
- }
-
- /**
- * Execute the console command.
- *
- * @return void
- */
- public function fire()
- {
- $cache = (new EventCache(new ClassFinder))->get(
- $this->laravel['config']->get('app.events.scan', [])
- );
-
- $this->files->put(
- $this->laravel['path.storage'].'/meta/events.php', $cache
- );
-
- $this->info('Events cached successfully!');
- }
-
-} | true |
Other | laravel | framework | 7b06179ebab9ab506ea6fe41a18c5214c0869e32.json | Remove event cache command. | src/Illuminate/Foundation/EventCache.php | @@ -1,130 +0,0 @@
-<?php namespace Illuminate\Foundation;
-
-use ReflectionClass;
-use ReflectionMethod;
-use Illuminate\Filesystem\ClassFinder;
-
-class EventCache {
-
- /**
- * The class finder instance.
- *
- * @var \Illuminate\Filesystem\ClassFinder $finder
- */
- protected $finder;
-
- /**
- * The event registration stub.
- *
- * @var string
- */
- protected $stub = '$events->listen(\'{{event}}\', \'{{handler}}\');';
-
- /**
- * Create a new event cache instance.
- *
- * @param \Illuminate\Filesystem\ClassFinder $finder
- * @return void
- */
- public function __construct(ClassFinder $finder)
- {
- $this->finder = $finder;
- }
-
- /**
- * Get the contents that should be written to a cache file.
- *
- * @param array $paths
- * @return string
- */
- public function get(array $paths)
- {
- $cache = '<?php $events = app(\'events\');'.PHP_EOL.PHP_EOL;
-
- foreach ($paths as $path)
- {
- $cache .= $this->getCacheForPath($path);
- }
-
- return $cache;
- }
-
- /**
- * Get the cache contents for a given path.
- *
- * @param string $path
- * @return string
- */
- protected function getCacheForPath($path)
- {
- $cache = '';
-
- foreach ($this->finder->findClasses($path) as $class)
- {
- $cache .= $this->getCacheForClass(new ReflectionClass($class));
- }
-
- return $cache;
- }
-
- /**
- * Get the cache for the given class reflection.
- *
- * @param \ReflectionClass $reflection
- * @return string|null
- */
- protected function getCacheForClass(ReflectionClass $reflection)
- {
- if ($reflection->isAbstract() && ! $reflection->isInterface())
- {
- continue;
- }
-
- foreach ($reflection->getMethods() as $method)
- {
- return $this->getCacheForMethod($method);
- }
- }
-
- /**
- * Get the cache for the given method reflection.
- *
- * @param \ReflectionMethod $method
- * @return string|null
- */
- protected function getCacheForMethod(ReflectionMethod $method)
- {
- preg_match_all('/@hears(.*)/', $method->getDocComment(), $matches);
-
- $events = [];
-
- if (isset($matches[1]) && count($matches[1]) > 0)
- {
- $events = array_map('trim', $matches[1]);
- }
-
- $cache = '';
-
- foreach ($events as $event)
- {
- $cache .= $this->formatEventStub($method, $event);
- }
-
- return $cache;
- }
-
- /**
- * Format the event listener stub for the given method and event.
- *
- * @param \ReflectionMethod $method
- * @param string $event
- * @return string
- */
- protected function formatEventStub(ReflectionMethod $method, $event)
- {
- $event = str_replace('{{event}}', $event, $this->stub);
-
- return str_replace('{{handler}}', $method->class.'@'.$method->name, $event).PHP_EOL;
- }
-
-} | true |
Other | laravel | framework | 7b06179ebab9ab506ea6fe41a18c5214c0869e32.json | Remove event cache command. | src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php | @@ -10,7 +10,6 @@
use Illuminate\Foundation\Console\ChangesCommand;
use Illuminate\Foundation\Console\OptimizeCommand;
use Illuminate\Foundation\Console\RouteListCommand;
-use Illuminate\Foundation\Console\EventCacheCommand;
use Illuminate\Foundation\Console\RouteCacheCommand;
use Illuminate\Foundation\Console\RouteClearCommand;
use Illuminate\Foundation\Console\ConsoleMakeCommand;
@@ -41,7 +40,6 @@ class ArtisanServiceProvider extends ServiceProvider {
'ConsoleMake',
'Down',
'Environment',
- 'EventCache',
'KeyGenerate',
'Optimize',
'ProviderMake',
@@ -161,19 +159,6 @@ protected function registerEnvironmentCommand()
});
}
- /**
- * Register the command.
- *
- * @return void
- */
- protected function registerEventCacheCommand()
- {
- $this->app->bindShared('command.event.cache', function($app)
- {
- return new EventCacheCommand($app['files']);
- });
- }
-
/**
* Register the command.
* | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.