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
d5c5f1306dd99c3cf606702b5b7ef51d6a73c752.json
Remove empty brackets from log files The current log files generated by Laravel all show empty brackets at the end of log files. We can remove these by using the $ignoreEmptyContextAndExtra parameter in the default Monolog LineFormatter. http://stackoverflow.com/questions/13968967/how-not-to-show-last-bracket-in-a-monolog-log-line
src/Illuminate/Log/composer.json
@@ -12,7 +12,7 @@ "php": ">=5.4.0", "illuminate/contracts": "5.0.*", "illuminate/support": "5.0.*", - "monolog/monolog": "~1.6" + "monolog/monolog": "~1.11" }, "autoload": { "psr-4": {
true
Other
laravel
framework
a71926653a573f32ca7a31527c7644c4305c1964.json
Allow some customization.
src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php
@@ -63,7 +63,7 @@ public function postRegister(Request $request) $this->auth->login($this->createUser($request->all())); - return redirect('/home'); + return redirect($this->redirectTo); } /** @@ -92,7 +92,7 @@ public function postLogin(Request $request) if ($this->auth->attempt($credentials, $request->has('remember'))) { - return redirect('/home'); + return redirect($this->redirectTo); } return redirect('/auth/login')
true
Other
laravel
framework
a71926653a573f32ca7a31527c7644c4305c1964.json
Allow some customization.
src/Illuminate/Foundation/Auth/ResetsPasswords.php
@@ -111,7 +111,7 @@ public function postReset(Request $request) switch ($response) { case PasswordBroker::PASSWORD_RESET: - return redirect('/home'); + return redirect($this->redirectTo); default: return redirect()->back()
true
Other
laravel
framework
808420b97de1af11b101db5f26d4891c50d19609.json
Return abort method
src/Illuminate/Foundation/Application.php
@@ -7,6 +7,7 @@ use Illuminate\Events\EventServiceProvider; use Illuminate\Routing\RoutingServiceProvider; use Illuminate\Contracts\Foundation\Application as ApplicationContract; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class Application extends Container implements ApplicationContract { @@ -702,6 +703,24 @@ public function down(Closure $callback) $this['events']->listen('illuminate.app.down', $callback); } + /** + * Throw an HttpException with the given data. + * + * @param int $code + * @param string $message + * @param array $headers + * @throws HttpException + */ + public function abort($code, $message = '', array $headers = array()) + { + if ($code == 404) + { + throw new NotFoundHttpException($message); + } + + throw new HttpException($code, $message, null, $headers); + } + /** * Get the service providers that have been loaded. *
false
Other
laravel
framework
fd10b3ce72de2dd48ba1c69c8475fd4cb98fce2d.json
Add doc block hints.
src/Illuminate/Console/Scheduling/Event.php
@@ -27,7 +27,7 @@ class Event { /** * The timezone the date should be evaluated on. * - * @var string + * @var \DateTimeZone|string */ protected $timezone; @@ -535,7 +535,7 @@ public function days($days) /** * Set the timezone the date should be evaluated on. * - * @param string $timezone + * @param \DateTimeZone|string $timezone * @return $this */ public function timezone($timezone)
false
Other
laravel
framework
91679d34f89876ef2d41719b87d584bdfdeea099.json
Add option for null queue driver.
src/Illuminate/Queue/Connectors/NullConnector.php
@@ -0,0 +1,16 @@ +<?php namespace Illuminate\Queue\Connectors; + +class NullConnector implements ConnectorInterface { + + /** + * Establish a queue connection. + * + * @param array $config + * @return \Illuminate\Contracts\Queue\Queue + */ + public function connect(array $config) + { + return new \Illuminate\Queue\NullQueue; + } + +}
true
Other
laravel
framework
91679d34f89876ef2d41719b87d584bdfdeea099.json
Add option for null queue driver.
src/Illuminate/Queue/NullQueue.php
@@ -0,0 +1,58 @@ +<?php namespace Illuminate\Queue; + +use Illuminate\Contracts\Queue\Queue as QueueContract; + +class NullQueue extends Queue implements QueueContract { + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + // + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = array()) + { + // + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTime|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + // + } + + /** + * Pop the next job off of the queue. + * + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + // + } + +}
true
Other
laravel
framework
91679d34f89876ef2d41719b87d584bdfdeea099.json
Add option for null queue driver.
src/Illuminate/Queue/QueueServiceProvider.php
@@ -7,6 +7,7 @@ use Illuminate\Queue\Console\RestartCommand; use Illuminate\Queue\Connectors\SqsConnector; use Illuminate\Queue\Console\SubscribeCommand; +use Illuminate\Queue\Connectors\NullConnector; use Illuminate\Queue\Connectors\SyncConnector; use Illuminate\Queue\Connectors\IronConnector; use Illuminate\Queue\Connectors\RedisConnector; @@ -167,12 +168,26 @@ protected function registerSubscriber() */ public function registerConnectors($manager) { - foreach (array('Sync', 'Beanstalkd', 'Redis', 'Sqs', 'Iron') as $connector) + foreach (array('Null', 'Sync', 'Beanstalkd', 'Redis', 'Sqs', 'Iron') as $connector) { $this->{"register{$connector}Connector"}($manager); } } + /** + * Register the Null queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerNullConnector($manager) + { + $manager->addConnector('null', function() + { + return new NullConnector; + }); + } + /** * Register the Sync queue connector. *
true
Other
laravel
framework
b1680a7404c8ee5433ef5bdd5af0f0ddcd0f6cb2.json
Add the request namespace to stubbed controllers.
src/Illuminate/Routing/Console/stubs/controller.plain.stub
@@ -1,5 +1,6 @@ <?php namespace {{namespace}}; +use {{rootNamespace}}Http\Requests; use {{rootNamespace}}Http\Controllers\Controller; class {{class}} extends Controller {
true
Other
laravel
framework
b1680a7404c8ee5433ef5bdd5af0f0ddcd0f6cb2.json
Add the request namespace to stubbed controllers.
src/Illuminate/Routing/Console/stubs/controller.stub
@@ -1,5 +1,6 @@ <?php namespace {{namespace}}; +use {{rootNamespace}}Http\Requests; use {{rootNamespace}}Http\Controllers\Controller; class {{class}} extends Controller {
true
Other
laravel
framework
47946db1374554c3c547876ead50b8c33d12c5a9.json
Fix the tests.
tests/Cache/CacheFileStoreTest.php
@@ -112,7 +112,7 @@ public function testFlushCleansDirectory() protected function mockFilesystem() { - return $this->getMock('Illuminate\Filesystem\Filesystem'); + return $this->getMock('Illuminate\Contracts\Filesystem\Filesystem'); } }
true
Other
laravel
framework
47946db1374554c3c547876ead50b8c33d12c5a9.json
Fix the tests.
tests/View/ViewBladeCompilerTest.php
@@ -472,7 +472,7 @@ public function testExpressionWithinHTML() protected function getFiles() { - return m::mock('Illuminate\Filesystem\Filesystem'); + return m::mock('Illuminate\Contracts\Filesystem\Filesystem'); } }
true
Other
laravel
framework
47946db1374554c3c547876ead50b8c33d12c5a9.json
Fix the tests.
tests/View/ViewFactoryTest.php
@@ -181,8 +181,8 @@ public function testComposersCanBeMassRegistered() new ReflectionFunction($composers[0]), new ReflectionFunction($composers[1]), ); - $this->assertEquals(array('class' => 'foo', 'method' => 'compose', 'container' => null), $reflections[0]->getStaticVariables()); - $this->assertEquals(array('class' => 'baz', 'method' => 'baz', 'container' => null), $reflections[1]->getStaticVariables()); + $this->assertEquals(array('class' => 'foo', 'method' => 'compose'), $reflections[0]->getStaticVariables()); + $this->assertEquals(array('class' => 'baz', 'method' => 'baz'), $reflections[1]->getStaticVariables()); }
true
Other
laravel
framework
47946db1374554c3c547876ead50b8c33d12c5a9.json
Fix the tests.
tests/View/ViewFileViewFinderTest.php
@@ -152,7 +152,7 @@ public function testPassingViewWithFalseHintReturnsFalse() protected function getFinder() { - return new Illuminate\View\FileViewFinder(m::mock('Illuminate\Filesystem\Filesystem'), array(__DIR__)); + return new Illuminate\View\FileViewFinder(m::mock('Illuminate\Contracts\Filesystem\Filesystem'), array(__DIR__)); } }
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/Auth/DatabaseUserProvider.php
@@ -1,6 +1,6 @@ <?php namespace Illuminate\Auth; -use Illuminate\Database\Connection; +use Illuminate\Database\ConnectionInterface; use Illuminate\Contracts\Hashing\Hasher as HasherContract; use Illuminate\Contracts\Auth\Authenticatable as UserContract; @@ -9,7 +9,7 @@ class DatabaseUserProvider implements UserProviderInterface { /** * The active database connection. * - * @var \Illuminate\Database\Connection + * @var \Illuminate\Database\ConnectionInterface */ protected $conn; @@ -30,12 +30,12 @@ class DatabaseUserProvider implements UserProviderInterface { /** * Create a new database user provider. * - * @param \Illuminate\Database\Connection $conn + * @param \Illuminate\Database\ConnectionInterface $conn * @param \Illuminate\Contracts\Hashing\Hasher $hasher * @param string $table * @return void */ - public function __construct(Connection $conn, HasherContract $hasher, $table) + public function __construct(ConnectionInterface $conn, HasherContract $hasher, $table) { $this->conn = $conn; $this->table = $table;
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php
@@ -1,15 +1,15 @@ <?php namespace Illuminate\Auth\Passwords; use Carbon\Carbon; -use Illuminate\Database\Connection; +use Illuminate\Database\ConnectionInterface; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; class DatabaseTokenRepository implements TokenRepositoryInterface { /** * The database connection instance. * - * @var \Illuminate\Database\Connection + * @var \Illuminate\Database\ConnectionInterface */ protected $connection; @@ -37,13 +37,13 @@ class DatabaseTokenRepository implements TokenRepositoryInterface { /** * Create a new token repository instance. * - * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\ConnectionInterface $connection * @param string $table * @param string $hashKey * @param int $expires * @return void */ - public function __construct(Connection $connection, $table, $hashKey, $expires = 60) + public function __construct(ConnectionInterface $connection, $table, $hashKey, $expires = 60) { $this->table = $table; $this->hashKey = $hashKey; @@ -186,7 +186,7 @@ protected function getTable() /** * Get the database connection instance. * - * @return \Illuminate\Database\Connection + * @return \Illuminate\Database\ConnectionInterface */ public function getConnection() {
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/Cache/Console/CacheTableCommand.php
@@ -1,7 +1,7 @@ <?php namespace Illuminate\Cache\Console; use Illuminate\Console\Command; -use Illuminate\Filesystem\Filesystem; +use Illuminate\Contracts\Filesystem\Filesystem; class CacheTableCommand extends Command { @@ -22,14 +22,14 @@ class CacheTableCommand extends Command { /** * The filesystem instance. * - * @var \Illuminate\Filesystem\Filesystem + * @var \Illuminate\Contracts\Filesystem\Filesystem */ protected $files; /** * Create a new session table command instance. * - * @param \Illuminate\Filesystem\Filesystem $files + * @param \Illuminate\Contracts\Filesystem\Filesystem $files * @return void */ public function __construct(Filesystem $files)
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/Cache/Console/ClearCommand.php
@@ -2,7 +2,7 @@ use Illuminate\Console\Command; use Illuminate\Cache\CacheManager; -use Illuminate\Filesystem\Filesystem; +use Illuminate\Contracts\Filesystem\Filesystem; class ClearCommand extends Command { @@ -30,15 +30,15 @@ class ClearCommand extends Command { /** * The file system instance. * - * @var \Illuminate\Filesystem\Filesystem + * @var \Illuminate\Contracts\Filesystem\Filesystem */ protected $files; /** * Create a new cache clear command instance. * * @param \Illuminate\Cache\CacheManager $cache - * @param \Illuminate\Filesystem\Filesystem $files + * @param \Illuminate\Contracts\Filesystem\Filesystem $files * @return void */ public function __construct(CacheManager $cache, Filesystem $files)
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/Cache/DatabaseStore.php
@@ -1,14 +1,14 @@ <?php namespace Illuminate\Cache; -use Illuminate\Database\Connection; +use Illuminate\Database\ConnectionInterface; use Illuminate\Contracts\Encryption\Encrypter as EncrypterContract; class DatabaseStore implements StoreInterface { /** * The database connection instance. * - * @var \Illuminate\Database\Connection + * @var \Illuminate\Database\ConnectionInterface */ protected $connection; @@ -36,13 +36,13 @@ class DatabaseStore implements StoreInterface { /** * Create a new database store. * - * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\ConnectionInterface $connection * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter * @param string $table * @param string $prefix * @return void */ - public function __construct(Connection $connection, EncrypterContract $encrypter, $table, $prefix = '') + public function __construct(ConnectionInterface $connection, EncrypterContract $encrypter, $table, $prefix = '') { $this->table = $table; $this->prefix = $prefix; @@ -195,7 +195,7 @@ protected function table() /** * Get the underlying database connection. * - * @return \Illuminate\Database\Connection + * @return \Illuminate\Database\ConnectionInterface */ public function getConnection() {
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/Cache/FileStore.php
@@ -1,6 +1,6 @@ <?php namespace Illuminate\Cache; -use Illuminate\Filesystem\Filesystem; +use Illuminate\Contracts\Filesystem\Filesystem; class FileStore implements StoreInterface { @@ -21,7 +21,7 @@ class FileStore implements StoreInterface { /** * Create a new file cache store instance. * - * @param \Illuminate\Filesystem\Filesystem $files + * @param \Illuminate\Contracts\Filesystem\Filesystem $files * @param string $directory * @return void */ @@ -226,7 +226,7 @@ protected function expiration($minutes) /** * Get the Filesystem instance. * - * @return \Illuminate\Filesystem\Filesystem + * @return \Illuminate\Contracts\Filesystem\Filesystem */ public function getFilesystem() {
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/Mail/Mailer.php
@@ -4,10 +4,10 @@ use Swift_Mailer; use Swift_Message; use Psr\Log\LoggerInterface; -use Illuminate\Container\Container; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Support\SerializableClosure; +use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\Queue\Queue as QueueContract; use Illuminate\Contracts\Mail\Mailer as MailerContract; use Illuminate\Contracts\Mail\MailQueue as MailQueueContract; @@ -52,11 +52,11 @@ class Mailer implements MailerContract, MailQueueContract { /** * The IoC container instance. * - * @var \Illuminate\Container\Container + * @var \Illuminate\Contracts\Container\Container */ protected $container; - /* + /** * The queue implementation. * * @var \Illuminate\Contracts\Queue\Queue @@ -386,7 +386,7 @@ protected function callMessageBuilder($callback, $message) } elseif (is_string($callback)) { - return $this->container[$callback]->mail($message); + return $this->container->make($callback)->mail($message); } throw new \InvalidArgumentException("Callback is not valid."); @@ -515,7 +515,7 @@ public function setQueue(QueueContract $queue) /** * Set the IoC container instance. * - * @param \Illuminate\Container\Container $container + * @param \Illuminate\Contracts\Container\Container $container * @return void */ public function setContainer(Container $container)
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/Session/Console/SessionTableCommand.php
@@ -1,7 +1,7 @@ <?php namespace Illuminate\Session\Console; use Illuminate\Console\Command; -use Illuminate\Filesystem\Filesystem; +use Illuminate\Contracts\Filesystem\Filesystem; class SessionTableCommand extends Command { @@ -22,14 +22,14 @@ class SessionTableCommand extends Command { /** * The filesystem instance. * - * @var \Illuminate\Filesystem\Filesystem + * @var \Illuminate\Contracts\Filesystem\Filesystem */ protected $files; /** * Create a new session table command instance. * - * @param \Illuminate\Filesystem\Filesystem $files + * @param \Illuminate\Contracts\Filesystem\Filesystem $files * @return void */ public function __construct(Filesystem $files)
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/Session/CookieSessionHandler.php
@@ -1,7 +1,7 @@ <?php namespace Illuminate\Session; use Symfony\Component\HttpFoundation\Request; -use Illuminate\Contracts\Cookie\Factory as CookieJar; +use Illuminate\Contracts\Cookie\QueueingFactory as CookieJar; class CookieSessionHandler implements \SessionHandlerInterface { @@ -22,7 +22,7 @@ class CookieSessionHandler implements \SessionHandlerInterface { /** * Create a new cookie driven handler instance. * - * @param \Illuminate\Contracts\Cookie\Factory $cookie + * @param \Illuminate\Contracts\Cookie\QueueingFactory $cookie * @param int $minutes * @return void */
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/Session/DatabaseSessionHandler.php
@@ -1,13 +1,13 @@ <?php namespace Illuminate\Session; -use Illuminate\Database\Connection; +use Illuminate\Database\ConnectionInterface; class DatabaseSessionHandler implements \SessionHandlerInterface, ExistenceAwareInterface { /** * The database connection instance. * - * @var \Illuminate\Database\Connection + * @var \Illuminate\Database\ConnectionInterface */ protected $connection; @@ -28,11 +28,11 @@ class DatabaseSessionHandler implements \SessionHandlerInterface, ExistenceAware /** * Create a new database session handler instance. * - * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\ConnectionInterface $connection * @param string $table * @return void */ - public function __construct(Connection $connection, $table) + public function __construct(ConnectionInterface $connection, $table) { $this->table = $table; $this->connection = $connection;
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/Session/FileSessionHandler.php
@@ -1,14 +1,14 @@ <?php namespace Illuminate\Session; use Symfony\Component\Finder\Finder; -use Illuminate\Filesystem\Filesystem; +use Illuminate\Contracts\Filesystem\Filesystem; class FileSessionHandler implements \SessionHandlerInterface { /** * The filesystem instance. * - * @var \Illuminate\Filesystem\Filesystem + * @var \Illuminate\Contracts\Filesystem\Filesystem */ protected $files; @@ -22,7 +22,7 @@ class FileSessionHandler implements \SessionHandlerInterface { /** * Create a new file driven handler instance. * - * @param \Illuminate\Filesystem\Filesystem $files + * @param \Illuminate\Contracts\Filesystem\Filesystem $files * @param string $path * @return void */
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/View/Compilers/Compiler.php
@@ -1,13 +1,13 @@ <?php namespace Illuminate\View\Compilers; -use Illuminate\Filesystem\Filesystem; +use Illuminate\Contracts\Filesystem\Filesystem; abstract class Compiler { /** * The Filesystem instance. * - * @var \Illuminate\Filesystem\Filesystem + * @var \Illuminate\Contracts\Filesystem\Filesystem */ protected $files; @@ -21,7 +21,7 @@ abstract class Compiler { /** * Create a new compiler instance. * - * @param \Illuminate\Filesystem\Filesystem $files + * @param \Illuminate\Contracts\Filesystem\Filesystem $files * @param string $cachePath * @return void */
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/View/Factory.php
@@ -1,10 +1,10 @@ <?php namespace Illuminate\View; use Closure; -use Illuminate\Container\Container; use Illuminate\Contracts\Support\Arrayable; use Illuminate\View\Engines\EngineResolver; use Illuminate\Contracts\Events\Dispatcher; +use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\View\Factory as FactoryContract; class Factory implements FactoryContract { @@ -33,7 +33,7 @@ class Factory implements FactoryContract { /** * The IoC container instance. * - * @var \Illuminate\Container\Container + * @var \Illuminate\Contracts\Container\Container */ protected $container; @@ -452,16 +452,14 @@ protected function addEventListener($name, $callback, $priority = null) */ protected function buildClassEventCallback($class, $prefix) { - $container = $this->container; - list($class, $method) = $this->parseClassEvent($class, $prefix); // Once we have the class and method name, we can build the Closure to resolve // the instance out of the IoC container and call the method on it with the // given arguments that are passed to the Closure as the composer's data. - return function() use ($class, $method, $container) + return function() use ($class, $method) { - $callable = array($container->make($class), $method); + $callable = array($this->container->make($class), $method); return call_user_func_array($callable, func_get_args()); }; @@ -805,7 +803,7 @@ public function setDispatcher(Dispatcher $events) /** * Get the IoC container instance. * - * @return \Illuminate\Container\Container + * @return \Illuminate\Contracts\Container\Container */ public function getContainer() { @@ -815,7 +813,7 @@ public function getContainer() /** * Set the IoC container instance. * - * @param \Illuminate\Container\Container $container + * @param \Illuminate\Contracts\Container\Container $container * @return void */ public function setContainer(Container $container)
true
Other
laravel
framework
a9f360273df4f441b1b14a5984de16dd95a44eac.json
Use interfaces as typehints where applicable.
src/Illuminate/View/FileViewFinder.php
@@ -1,13 +1,13 @@ <?php namespace Illuminate\View; -use Illuminate\Filesystem\Filesystem; +use Illuminate\Contracts\Filesystem\Filesystem; class FileViewFinder implements ViewFinderInterface { /** * The filesystem instance. * - * @var \Illuminate\Filesystem\Filesystem + * @var \Illuminate\Contracts\Filesystem\Filesystem */ protected $files; @@ -42,7 +42,7 @@ class FileViewFinder implements ViewFinderInterface { /** * Create a new file view loader instance. * - * @param \Illuminate\Filesystem\Filesystem $files + * @param \Illuminate\Contracts\Filesystem\Filesystem $files * @param array $paths * @param array $extensions * @return void @@ -233,7 +233,7 @@ public function hasHintInformation($name) /** * Get the filesystem instance. * - * @return \Illuminate\Filesystem\Filesystem + * @return \Illuminate\Contracts\Filesystem\Filesystem */ public function getFilesystem() {
true
Other
laravel
framework
eeb2348373bfa60fce0e5c32c436b44929bd6cd6.json
Remove some requests from fresh command.
src/Illuminate/Foundation/Console/FreshCommand.php
@@ -80,8 +80,6 @@ protected function getFiles() base_path('bower.json'), base_path('gulpfile.js'), base_path('package.json'), - app_path('Http/Requests/LoginRequest.php'), - app_path('Http/Requests/RegisterRequest.php'), app_path('Http/Controllers/AuthController.php'), base_path('resources/views/dashboard.blade.php'), app_path('Http/Controllers/PasswordController.php'),
false
Other
laravel
framework
ded96052a6c23d9ad895e41776e9d1eb0c394bf4.json
Reset indentation and sort words
src/Illuminate/Support/Pluralizer.php
@@ -107,9 +107,11 @@ class Pluralizer { 'audio', 'bison', 'chassis', + 'compensation', 'coreopsis', 'data', 'deer', + 'education', 'equipment', 'fish', 'gold',
false
Other
laravel
framework
fa33e07b91b33da934d581874c0e8ae919d12be7.json
Add ability to easily queue an Artisan command.
src/Illuminate/Contracts/Console/Kernel.php
@@ -20,6 +20,15 @@ public function handle($input, $output = null); */ public function call($command, array $parameters = array()); + /** + * Queue an Artisan console command by name. + * + * @param string $command + * @param array $parameters + * @return int + */ + public function queue($command, array $parameters = array()); + /** * Get all of the commands registered with the console. *
true
Other
laravel
framework
fa33e07b91b33da934d581874c0e8ae919d12be7.json
Add ability to easily queue an Artisan command.
src/Illuminate/Foundation/Console/Kernel.php
@@ -124,6 +124,20 @@ public function call($command, array $parameters = array()) return $this->getArtisan()->call($command, $parameters); } + /** + * Queue the given console command. + * + * @param string $command + * @param array $parameters + * @return void + */ + public function queue($command, array $parameters = array()) + { + $this->app['Illuminate\Contracts\Queue\Queue']->push( + 'Illuminate\Foundation\Console\QueuedJob', func_get_args() + ); + } + /** * Get all of the commands registered with the console. *
true
Other
laravel
framework
fa33e07b91b33da934d581874c0e8ae919d12be7.json
Add ability to easily queue an Artisan command.
src/Illuminate/Foundation/Console/QueuedJob.php
@@ -0,0 +1,39 @@ +<?php namespace Illuminate\Foundation\Console; + +use Illuminate\Contracts\Console\Kernel; + +class QueuedJob { + + /** + * The kernel instance. + * + * @var \Illuminate\Contracts\Console\Kernel + */ + protected $kernel; + + /** + * Create a new job instance. + * + * @param \Illuminate\Contracts\Console\Kernel $kernel + * @return void + */ + public function __construct(Kernel $kernel) + { + $this->kernel = $kernel; + } + + /** + * Fire the job. + * + * @param \Illuminate\Queue\Jobs\Job + * @param array $data + * @return void + */ + public function fire($job, $data) + { + $status = call_user_func_array([$this->kernel, 'call'], $data); + + $job->delete(); + } + +}
true
Other
laravel
framework
8de2d9d6f71bec53c6bf67e944f7382b3bade1ce.json
Use line here.
src/Illuminate/Foundation/Console/FreshCommand.php
@@ -50,14 +50,14 @@ public function fire() { $this->files->delete($file); - $this->info('<info>Removed File:</info> '.$file); + $this->line('<info>Removed File:</info> '.$file); } foreach ($this->getDirectories() as $directory) { $this->files->deleteDirectory($directory); - $this->info('<comment>Removed Directory:</comment> '.$directory); + $this->line('<comment>Removed Directory:</comment> '.$directory); } $this->info('Scaffolding Removed!');
false
Other
laravel
framework
a9604f4f9ce8e6ebf4a834476cd686b6caf568f4.json
Build a "fresh" command.
src/Illuminate/Foundation/Console/FreshCommand.php
@@ -0,0 +1,79 @@ +<?php namespace Illuminate\Foundation\Console; + +use Illuminate\Console\Command; +use Illuminate\Filesystem\Filesystem; + +class FreshCommand extends Command { + + /** + * The console command name. + * + * @var string + */ + protected $name = 'fresh'; + + /** + * The console command description. + * + * @var string + */ + protected $description = "Remove some of Laravel's opionated scaffolding"; + + /** + * Create a new 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() + { + foreach ($this->getFiles() as $file) + { + $this->files->delete($file); + + $this->info('<info>Removed File:</info> '.$file); + } + + foreach ($this->getDirectories() as $directory) + { + $this->files->deleteDirectory($directory); + + $this->info('<comment>Removed Directory:</comment> '.$directory); + } + + $this->info('Scaffolding Removed!'); + } + + /** + * Get the files that should be deleted. + * + * @return array + */ + protected function getFiles() + { + return []; + } + + /** + * Get the directories that should be deleted. + * + * @return array + */ + protected function getDirectories() + { + return []; + } + +}
true
Other
laravel
framework
a9604f4f9ce8e6ebf4a834476cd686b6caf568f4.json
Build a "fresh" command.
src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php
@@ -3,6 +3,7 @@ use Illuminate\Support\ServiceProvider; use Illuminate\Foundation\Console\UpCommand; use Illuminate\Foundation\Console\DownCommand; +use Illuminate\Foundation\Console\FreshCommand; use Illuminate\Foundation\Console\TinkerCommand; use Illuminate\Foundation\Console\AppNameCommand; use Illuminate\Foundation\Console\ChangesCommand; @@ -41,6 +42,7 @@ class ArtisanServiceProvider extends ServiceProvider { 'Down' => 'command.down', 'Environment' => 'command.environment', 'EventScan' => 'command.event.scan', + 'Fresh' => 'command.fresh', 'KeyGenerate' => 'command.key.generate', 'Optimize' => 'command.optimize', 'ProviderMake' => 'command.provider.make', @@ -161,6 +163,19 @@ protected function registerEventScanCommand() }); } + /** + * Register the command. + * + * @return void + */ + protected function registerFreshCommand() + { + $this->app->singleton('command.fresh', function() + { + return new FreshCommand; + }); + } + /** * Register the command. *
true
Other
laravel
framework
84c42305e562c5710fd45e9082ea1ed5c57705b0.json
Remove the serve command.
src/Illuminate/Foundation/Console/ServeCommand.php
@@ -1,73 +0,0 @@ -<?php namespace Illuminate\Foundation\Console; - -use Illuminate\Console\Command; -use Symfony\Component\Console\Input\InputOption; - -class ServeCommand extends Command { - - /** - * The console command name. - * - * @var string - */ - protected $name = 'serve'; - - /** - * The console command description. - * - * @var string - */ - protected $description = "Serve the application on the PHP development server"; - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->checkPhpVersion(); - - chdir($this->laravel['path.base']); - - $host = $this->input->getOption('host'); - - $port = $this->input->getOption('port'); - - $public = $this->laravel['path.public']; - - $this->info("Laravel development server started on http://{$host}:{$port}"); - - passthru('"'.PHP_BINARY.'"'." -S {$host}:{$port} -t \"{$public}\" server.php"); - } - - /** - * Check the current PHP version is >= 5.4. - * - * @return void - * - * @throws \Exception - */ - protected function checkPhpVersion() - { - if (version_compare(PHP_VERSION, '5.4.0', '<')) - { - throw new \Exception('This PHP binary is not version 5.4 or greater.'); - } - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on.', 'localhost'), - - array('port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on.', 8000), - ); - } - -}
true
Other
laravel
framework
84c42305e562c5710fd45e9082ea1ed5c57705b0.json
Remove the serve command.
src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php
@@ -3,7 +3,6 @@ use Illuminate\Support\ServiceProvider; use Illuminate\Foundation\Console\UpCommand; use Illuminate\Foundation\Console\DownCommand; -use Illuminate\Foundation\Console\ServeCommand; use Illuminate\Foundation\Console\TinkerCommand; use Illuminate\Foundation\Console\AppNameCommand; use Illuminate\Foundation\Console\ChangesCommand; @@ -50,7 +49,6 @@ class ArtisanServiceProvider extends ServiceProvider { 'RouteClear' => 'command.route.clear', 'RouteList' => 'command.route.list', 'RouteScan' => 'command.route.scan', - 'Serve' => 'command.serve', 'Tinker' => 'command.tinker', 'Up' => 'command.up', ]; @@ -267,19 +265,6 @@ protected function registerRouteScanCommand() }); } - /** - * Register the command. - * - * @return void - */ - protected function registerServeCommand() - { - $this->app->singleton('command.serve', function() - { - return new ServeCommand; - }); - } - /** * Register the command. *
true
Other
laravel
framework
423487fa9ac58a37ef22f32abe54e546b482d013.json
Pass proper value to class.
src/Illuminate/Queue/Console/WorkCommand.php
@@ -91,7 +91,9 @@ protected function runWorker($connection, $queue, $delay, $memory, $daemon = fal { $this->worker->setCache($this->laravel['cache']->driver()); - $this->worker->setDaemonExceptionHandler($this->laravel['exception']); + $this->worker->setDaemonExceptionHandler( + $this->laravel['Illuminate\Contracts\Debug\ExceptionHandler'] + ); return $this->worker->daemon( $connection, $queue, $delay, $memory,
false
Other
laravel
framework
e09adf4c7ce8e42a5628634f05da4419c2fcfb8b.json
Require aws-sdk-php >= 2.7.5
composer.json
@@ -66,7 +66,7 @@ "illuminate/workbench": "self.version" }, "require-dev": { - "aws/aws-sdk-php": "~2.6", + "aws/aws-sdk-php": ">=2.7.5", "iron-io/iron_mq": "~1.5", "pda/pheanstalk": "~3.0", "mockery/mockery": "~0.9",
false
Other
laravel
framework
2f07cfea0ec5a855ba0d0861a5fc26903fc8285c.json
Add mail transport for AWS SES
src/Illuminate/Mail/Transport/SesTransport.php
@@ -0,0 +1,96 @@ +<?php namespace Illuminate\Mail\Transport; + +use Swift_Transport; +use Aws\Ses\SesClient; +use Swift_Mime_Message; +use Swift_Events_EventListener; + +class SesTransport implements Swift_Transport { + + /** + * The Amazon SES instance. + * + * @var \Aws\Ses\SesClient + */ + protected $ses; + + /** + * Create a new Mailgun transport instance. + * + * @param \Aws\Ses\SesClient $ses + * @return void + */ + public function __construct(SesClient $ses) + { + $this->ses = $ses; + } + + /** + * {@inheritdoc} + */ + public function isStarted() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function start() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function stop() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_Message $message, &$failedRecipients = null) + { + $this->ses->sendRawEmail([ + 'Source' => $message->getSender(), + 'Destinations' => $this->getTo($message), + 'RawMessage' => [ + 'Data' => base64_encode((string) $message) + ] + ]); + } + + /** + * {@inheritdoc} + */ + public function registerPlugin(Swift_Events_EventListener $plugin) + { + // + } + + /** + * Get the "to" payload field for the API request. + * + * @param \Swift_Mime_Message $message + * @return array + */ + protected function getTo(Swift_Mime_Message $message) + { + $destinations = []; + + $contacts = array_merge( + (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc() + ); + + foreach ($contacts as $address => $display) + { + $destinations[] = $address; + } + + return $destinations; + } + +}
true
Other
laravel
framework
2f07cfea0ec5a855ba0d0861a5fc26903fc8285c.json
Add mail transport for AWS SES
src/Illuminate/Mail/TransportManager.php
@@ -1,5 +1,6 @@ <?php namespace Illuminate\Mail; +use Aws\Ses\SesClient; use Illuminate\Support\Manager; use Swift_SmtpTransport as SmtpTransport; use Swift_MailTransport as MailTransport; @@ -56,6 +57,20 @@ protected function createSendmailDriver() return SendmailTransport::newInstance($command); } + /** + * Create an instance of the SES Swift Transport drive. + * + * @return \Swift_SendmailTransport + */ + protected function createSesDriver() + { + $ses = $this->app['config']->get('services.ses', array()); + + $sesClient = SesClient::factory($ses); + + return new SesTransport($sesClient); + } + /** * Create an instance of the Mail Swift Transport driver. *
true
Other
laravel
framework
19317c9a545c58d8274df23da96c0d2a9c261fc6.json
Change some syntax.
src/Illuminate/Console/Scheduling/Schedule.php
@@ -30,9 +30,9 @@ public function call($callback, array $parameters = array()) * @param string $command * @return \Illuminate\Console\Scheduling\Event */ - public function artisan($command) + public function command($command) { - return $this->command(PHP_BINARY.' artisan '.$command); + return $this->exec(PHP_BINARY.' artisan '.$command); } /** @@ -41,7 +41,7 @@ public function artisan($command) * @param string $command * @return \Illuminate\Console\Scheduling\Event */ - public function command($command) + public function exec($command) { $this->events[] = $event = new Event($command);
false
Other
laravel
framework
a6e1aa68b47903c54410bcca62ae96ee8fd7a630.json
Remove duplicate method.
src/Illuminate/Foundation/Console/Kernel.php
@@ -136,18 +136,6 @@ public function all() return $this->getArtisan()->all(); } - /** - * Get all of the commands registered with the console. - * - * @return array - */ - public function all() - { - $this->bootstrap(); - - return $this->getArtisan()->all(); - } - /** * Get the output for the last run command. *
false
Other
laravel
framework
cc387a9e5068cb7350b1161a0b38bacedbb88544.json
Change the default namespace for new commands.
src/Illuminate/Foundation/Console/ConsoleMakeCommand.php
@@ -59,7 +59,7 @@ protected function getStub() */ protected function getDefaultNamespace($rootNamespace) { - return $rootNamespace.'\Console'; + return $rootNamespace.'\Console\Commands'; } /**
false
Other
laravel
framework
1324e78a037f236f33d6c88787a5e3b1c4fb912b.json
Use local file loading method in FileLoader Before, to switch formats you had to extend and override a bunch of methods: * `\Illuminate\Config\FileLoader::load` * `\Illuminate\Config\FileLoader::mergeEnvironment` * `\Illuminate\Config\FileLoader::getRequire` This is a pain for obvious reasons, I may want to use json format, but I might want the Load method to work as it does in the framework. with this change, the only method that needs overriding is `\Illuminate\Config\FileLoader::getRequire`.
src/Illuminate/Config/FileLoader.php
@@ -74,7 +74,7 @@ public function load($environment, $group, $namespace = null) if ($this->files->exists($file)) { - $items = $this->files->getRequire($file); + $items = $this->getRequire($file); } // Finally we're ready to check for the environment specific configuration @@ -99,7 +99,7 @@ public function load($environment, $group, $namespace = null) */ protected function mergeEnvironment(array $items, $file) { - return array_replace_recursive($items, $this->files->getRequire($file)); + return array_replace_recursive($items, $this->getRequire($file)); } /**
false
Other
laravel
framework
81614916082260c524b5a178e896f3f0ce79b820.json
Add all method to console kernel.
src/Illuminate/Contracts/Console/Kernel.php
@@ -20,6 +20,13 @@ public function handle($input, $output = null); */ public function call($command, array $parameters = array()); + /** + * Get all of the commands registered with the console. + * + * @return array + */ + public function all(); + /** * Get the output for the last run command. *
true
Other
laravel
framework
81614916082260c524b5a178e896f3f0ce79b820.json
Add all method to console kernel.
src/Illuminate/Foundation/Console/Kernel.php
@@ -86,6 +86,18 @@ public function call($command, array $parameters = array()) return $this->getArtisan()->call($command, $parameters); } + /** + * Get all of the commands registered with the console. + * + * @return array + */ + public function all() + { + $this->bootstrap(); + + return $this->getArtisan()->all(); + } + /** * Get the output for the last run command. *
true
Other
laravel
framework
63957edb932abda1d11b5cd0f383e3b0dfd24813.json
Add getVisible method
src/Illuminate/Database/Eloquent/Model.php
@@ -2081,6 +2081,16 @@ public function addHidden($attributes = null) $this->hidden = array_merge($this->hidden, $attributes); } + + /** + * Get the visible attributes for the model. + * + * @return array + */ + public function getVisible() + { + return $this->visible; + } /** * Set the visible attributes for the model.
false
Other
laravel
framework
c50086cb7b09ffae771618a0ba45092043b052b1.json
Pass array instead of just integer.
src/Illuminate/Filesystem/FilesystemAdapter.php
@@ -68,7 +68,7 @@ public function get($path) */ public function put($path, $contents, $visibility = null) { - return $this->driver->put($path, $contents, $this->parseVisibility($visibility)); + return $this->driver->put($path, $contents, ['visibility' => $this->parseVisibility($visibility)]); } /**
false
Other
laravel
framework
2eae07bd5f60966788ad52887eeb6572443d612a.json
Move middleware into core.
src/Illuminate/Foundation/Http/Middleware/UnderMaintenance.php
@@ -0,0 +1,45 @@ +<?php namespace Illuminate\Foundation\Http\Middleware; + +use Closure; +use Illuminate\Http\Response; +use Illuminate\Contracts\Routing\Middleware; +use Illuminate\Contracts\Foundation\Application; + +class UnderMaintenance implements Middleware { + + /** + * The application implementation. + * + * @var Application + */ + protected $app; + + /** + * Create a new filter instance. + * + * @param Application $app + * @return void + */ + public function __construct(Application $app) + { + $this->app = $app; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + if ($this->app->isDownForMaintenance()) + { + return new Response(view('framework.maintenance'), 503); + } + + return $next($request); + } + +}
false
Other
laravel
framework
ab569fb44bdb83ba250fa1cd800b6543a1414ee0.json
Check route before calling method.
src/Illuminate/Http/Request.php
@@ -703,7 +703,7 @@ public function __get($key) { return $this->input($key); } - else + elseif ( ! is_null($this->route())) { return $this->route()->parameter($key); }
false
Other
laravel
framework
f8c1b19cd13f6700e110373a68c8a646776bb1a2.json
Allow dynamic access of route parameters.
src/Illuminate/Routing/Route.php
@@ -946,4 +946,15 @@ public function prepareForSerialization() unset($this->compiled); } + /** + * Dynamically access route parameters. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->parameter($key); + } + }
false
Other
laravel
framework
96d80ee2bff037fc4eb58e144c9aa0e177ce355f.json
Rename some traits to be less stupid.
src/Illuminate/Auth/Authenticates.php
@@ -1,6 +1,6 @@ <?php namespace Illuminate\Auth; -trait UserTrait { +trait Authenticates { /** * Get the unique identifier for the user.
true
Other
laravel
framework
96d80ee2bff037fc4eb58e144c9aa0e177ce355f.json
Rename some traits to be less stupid.
src/Illuminate/Auth/Passwords/ResetsPassword.php
@@ -1,6 +1,6 @@ <?php namespace Illuminate\Auth\Passwords; -trait CanResetPasswordTrait { +trait ResetsPassword { /** * Get the e-mail address where password reset links are sent.
true
Other
laravel
framework
96d80ee2bff037fc4eb58e144c9aa0e177ce355f.json
Rename some traits to be less stupid.
src/Illuminate/Database/Eloquent/SoftDeletes.php
@@ -1,6 +1,6 @@ <?php namespace Illuminate\Database\Eloquent; -trait SoftDeletingTrait { +trait SoftDeletes { /** * Indicates if the model is currently force deleting. @@ -14,7 +14,7 @@ trait SoftDeletingTrait { * * @return void */ - public static function bootSoftDeletingTrait() + public static function bootSoftDeletes() { static::addGlobalScope(new SoftDeletingScope); }
true
Other
laravel
framework
96d80ee2bff037fc4eb58e144c9aa0e177ce355f.json
Rename some traits to be less stupid.
tests/Database/DatabaseEloquentBuilderTest.php
@@ -468,14 +468,14 @@ public function scopeApproved($query) } class EloquentBuilderTestWithTrashedStub extends Illuminate\Database\Eloquent\Model { - use Illuminate\Database\Eloquent\SoftDeletingTrait; + use Illuminate\Database\Eloquent\SoftDeletes; protected $table = 'table'; public function getKeyName() { return 'foo'; } } class EloquentBuilderTestNestedStub extends Illuminate\Database\Eloquent\Model { protected $table = 'table'; - use Illuminate\Database\Eloquent\SoftDeletingTrait; + use Illuminate\Database\Eloquent\SoftDeletes; } class EloquentBuilderTestListsStub {
true
Other
laravel
framework
96d80ee2bff037fc4eb58e144c9aa0e177ce355f.json
Rename some traits to be less stupid.
tests/Database/DatabaseSoftDeletingTraitTest.php
@@ -51,7 +51,7 @@ public function testRestoreCancel() class DatabaseSoftDeletingTraitStub { - use Illuminate\Database\Eloquent\SoftDeletingTrait; + use Illuminate\Database\Eloquent\SoftDeletes; public $deleted_at; public function newQuery() {
true
Other
laravel
framework
9f7af57c281cc767dbf3407e56cbe917c9c3498a.json
Change Auth to use short array syntax
src/Illuminate/Auth/DatabaseUserProvider.php
@@ -89,7 +89,7 @@ public function updateRememberToken(UserContract $user, $token) { $this->conn->table($this->table) ->where('id', $user->getAuthIdentifier()) - ->update(array('remember_token' => $token)); + ->update(['remember_token' => $token]); } /**
true
Other
laravel
framework
9f7af57c281cc767dbf3407e56cbe917c9c3498a.json
Change Auth to use short array syntax
src/Illuminate/Auth/Guard.php
@@ -235,7 +235,7 @@ protected function validRecaller($recaller) * @param array $credentials * @return bool */ - public function once(array $credentials = array()) + public function once(array $credentials = []) { if ($this->validate($credentials)) { @@ -253,7 +253,7 @@ public function once(array $credentials = array()) * @param array $credentials * @return bool */ - public function validate(array $credentials = array()) + public function validate(array $credentials = []) { return $this->attempt($credentials, false, false); } @@ -313,7 +313,7 @@ protected function attemptBasic(Request $request, $field) */ protected function getBasicCredentials(Request $request, $field) { - return array($field => $request->getUser(), 'password' => $request->getPassword()); + return [$field => $request->getUser(), 'password' => $request->getPassword()]; } /** @@ -323,7 +323,7 @@ protected function getBasicCredentials(Request $request, $field) */ protected function getBasicResponse() { - $headers = array('WWW-Authenticate' => 'Basic'); + $headers = ['WWW-Authenticate' => 'Basic']; return new Response('Invalid credentials.', 401, $headers); } @@ -336,7 +336,7 @@ protected function getBasicResponse() * @param bool $login * @return bool */ - public function attempt(array $credentials = array(), $remember = false, $login = true) + public function attempt(array $credentials = [], $remember = false, $login = true) { $this->fireAttemptEvent($credentials, $remember, $login); @@ -379,7 +379,7 @@ protected function fireAttemptEvent(array $credentials, $remember, $login) { if ($this->events) { - $payload = array($credentials, $remember, $login); + $payload = [$credentials, $remember, $login]; $this->events->fire('auth.attempt', $payload); } @@ -425,7 +425,7 @@ public function login(UserContract $user, $remember = false) // based on the login and logout events fired from the guard instances. if (isset($this->events)) { - $this->events->fire('auth.login', array($user, $remember)); + $this->events->fire('auth.login', [$user, $remember]); } $this->setUser($user); @@ -518,7 +518,7 @@ public function logout() if (isset($this->events)) { - $this->events->fire('auth.logout', array($user)); + $this->events->fire('auth.logout', [$user]); } // Once we have fired the logout event we will clear the users out of memory
true
Other
laravel
framework
9f7af57c281cc767dbf3407e56cbe917c9c3498a.json
Change Auth to use short array syntax
src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php
@@ -93,7 +93,7 @@ protected function deleteExisting(CanResetPassword $user) */ protected function getPayload($email, $token) { - return array('email' => $email, 'token' => $token, 'created_at' => new Carbon); + return ['email' => $email, 'token' => $token, 'created_at' => new Carbon]; } /**
true
Other
laravel
framework
9f7af57c281cc767dbf3407e56cbe917c9c3498a.json
Change Auth to use short array syntax
src/Illuminate/Auth/Passwords/PasswordBroker.php
@@ -230,7 +230,7 @@ protected function validatePasswordWithDefaults(array $credentials) */ public function getUser(array $credentials) { - $credentials = array_except($credentials, array('token')); + $credentials = array_except($credentials, ['token']); $user = $this->users->retrieveByCredentials($credentials);
true
Other
laravel
framework
9f7af57c281cc767dbf3407e56cbe917c9c3498a.json
Change Auth to use short array syntax
src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php
@@ -82,7 +82,7 @@ protected function registerTokenRepository() */ public function provides() { - return array('auth.password', 'auth.password.tokens'); + return ['auth.password', 'auth.password.tokens']; } }
true
Other
laravel
framework
9149adac43f02be1fe12513e3613853bcd72d860.json
Add tests for App::environment().
tests/Foundation/FoundationApplicationTest.php
@@ -114,6 +114,23 @@ public function testSingleProviderCanProvideMultipleDeferredServices() $this->assertEquals('foobar', $app->make('bar')); } + + public function testEnvironment() + { + $app = new Application; + $app['env'] = 'foo'; + + $this->assertEquals('foo', $app->environment()); + + $this->assertTrue($app->environment('foo')); + $this->assertTrue($app->environment('foo', 'bar')); + $this->assertTrue($app->environment(['foo', 'bar'])); + + $this->assertFalse($app->environment('qux')); + $this->assertFalse($app->environment('qux', 'bar')); + $this->assertFalse($app->environment(['qux', 'bar'])); + } + } class ApplicationCustomExceptionHandlerStub extends Illuminate\Foundation\Application {
false
Other
laravel
framework
c4d367a991f62c153c28769dc32b1353acff9383.json
Add instance() to the container contract.
src/Illuminate/Contracts/Container/Container.php
@@ -78,6 +78,15 @@ public function singleton($abstract, $concrete = null); */ public function extend($abstract, Closure $closure); + /** + * Register an existing instance as shared in the container. + * + * @param string $abstract + * @param mixed $instance + * @return void + */ + public function instance($abstract, $instance); + /** * Define a contextual binding. *
false
Other
laravel
framework
15ccd0bb8ade9b54e9bc776344de0515408d9ff0.json
Use singleton method for binding shared instance.
src/Illuminate/Events/EventServiceProvider.php
@@ -11,7 +11,7 @@ class EventServiceProvider extends ServiceProvider { */ public function register() { - $this->app['events'] = $this->app->share(function($app) + $this->app->singleton('events', function($app) { return new Dispatcher($app); });
false
Other
laravel
framework
3a06c91468cc2453a82590208c06bd4037c421f4.json
Pass session to FormRequest Without this, the FormRequest does not have access to the session and cannot access things like url.intended in order to do redirects after login.
src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php
@@ -60,6 +60,8 @@ protected function initializeRequest(FormRequest $form, Request $current) $current->cookies->all(), $files, $current->server->all(), $current->getContent() ); + $form->setSession($current->getSession()); + $form->setUserResolver($current->getUserResolver()); $form->setRouteResolver($current->getRouteResolver());
false
Other
laravel
framework
3e222ca538ed033c1bb12cca30678701c395f126.json
Remove curly bracket
src/Illuminate/Foundation/Http/FormRequest.php
@@ -192,7 +192,7 @@ protected function getRedirectUrl() return $url->action($this->redirectAction); } - return $url->previous();} + return $url->previous(); } /**
false
Other
laravel
framework
b6d1e7ecb0ad5375a7d8b0e99ce4ead16af8afc6.json
Compile more files.
src/Illuminate/Foundation/Console/Optimize/config.php
@@ -18,6 +18,7 @@ $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/HttpKernel.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', @@ -32,6 +33,14 @@ $basePath.'/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Application.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Http/Request.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Http/FrameGuard.php', $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php', @@ -50,14 +59,19 @@ $basePath.'/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/AggregateServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/ControllerServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Providers/EventServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/RouteServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Pagination/Paginator.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/Traits/MacroableTrait.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/Arr.php', @@ -87,7 +101,9 @@ $basePath.'/vendor/symfony/routing/Symfony/Component/Routing/Route.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Controller.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/ControllerInspector.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Stack.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php', @@ -100,18 +116,21 @@ $basePath.'/vendor/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Session/SessionInterface.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Session/Middleware/Reader.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Session/Middleware/Writer.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Session/Middleware/ReadSession.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Session/Middleware/WriteSession.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Session/Middleware/MiddlewareTrait.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Session/Store.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Session/SessionManager.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/Manager.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Support/Collection.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Cookie/CookieJar.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/Guard.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/Queue.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToRequest.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/Facades/Log.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Log/Writer.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php', $basePath.'/vendor/monolog/monolog/src/Monolog/Logger.php', $basePath.'/vendor/psr/log/Psr/Log/LoggerInterface.php', $basePath.'/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php',
false
Other
laravel
framework
e86ada0d62d92fe8cc6df6b7d08b92bdfaeec1e5.json
Add failing test for mass composer registration.
tests/View/ViewFactoryTest.php
@@ -176,6 +176,7 @@ public function testComposersCanBeMassRegistered() 'baz@baz' => array('qux', 'foo'), )); + $this->assertCount(3, $composers); $reflections = array( new ReflectionFunction($composers[0]), new ReflectionFunction($composers[1]),
false
Other
laravel
framework
a9c7b77e0018a30080e68d6870d04f0e1569790c.json
Add default implementation of exception handler.
src/Illuminate/Foundation/Debug/ExceptionHandler.php
@@ -0,0 +1,63 @@ +<?php namespace Illuminate\Foundation\Debug; + +use Exception; +use Psr\Log\LoggerInterface; +use Symfony\Component\Debug\ExceptionHandler as SymfonyDisplayer; +use Illuminate\Contracts\Debug\ExceptionHandler as ExceptionHandlerContract; + +class ExceptionHandler implements ExceptionHandlerContract { + + /** + * The log implementation. + * + * @var \Psr\Log\LoggerInterface + */ + protected $log; + + /** + * Create a new exception handler instance. + * + * @param \Psr\Log\LoggerInterface $log + * @return void + */ + public function __construct(LoggerInterface $log) + { + $this->log = $log; + } + + /** + * Report or log an exception. + * + * @param \Exception $e + * @return void + */ + public function report(Exception $e) + { + $this->log->error((string) $e); + } + + /** + * Render an exception into a response. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Symfony\Component\HttpFoundation\Response + */ + public function render($request, Exception $e) + { + return (new SymfonyDisplayer)->createResponse($e); + } + + /** + * Render an exception to the console. + * + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @param \Exception $e + * @return void + */ + public function renderForConsole($output, Exception $e) + { + $output->writeln((string) $e); + } + +}
false
Other
laravel
framework
982c68121c2645a6ec812b6a5eae1b0244e16094.json
Use correct interface in tests.
tests/Auth/AuthGuardTest.php
@@ -93,7 +93,7 @@ public function testLoginStoresIdentifierInSession() $user = m::mock('Illuminate\Contracts\Auth\User'); $mock->expects($this->once())->method('getName')->will($this->returnValue('foo')); $user->shouldReceive('getAuthIdentifier')->once()->andReturn('bar'); - $mock->getSession()->shouldReceive('put')->with('foo', 'bar')->once(); + $mock->getSession()->shouldReceive('set')->with('foo', 'bar')->once(); $session->shouldReceive('migrate')->once(); $mock->login($user); } @@ -108,7 +108,7 @@ public function testLoginFiresLoginEvent() $events->shouldReceive('fire')->once()->with('auth.login', array($user, false)); $mock->expects($this->once())->method('getName')->will($this->returnValue('foo')); $user->shouldReceive('getAuthIdentifier')->once()->andReturn('bar'); - $mock->getSession()->shouldReceive('put')->with('foo', 'bar')->once(); + $mock->getSession()->shouldReceive('set')->with('foo', 'bar')->once(); $session->shouldReceive('migrate')->once(); $mock->login($user); } @@ -176,7 +176,7 @@ public function testLogoutRemovesSessionTokenAndRememberMeCookie() $cookie = m::mock('Symfony\Component\HttpFoundation\Cookie'); $cookies->shouldReceive('forget')->once()->with('bar')->andReturn($cookie); $cookies->shouldReceive('queue')->once()->with($cookie); - $mock->getSession()->shouldReceive('forget')->once()->with('foo'); + $mock->getSession()->shouldReceive('remove')->once()->with('foo'); $mock->setUser($user); $mock->logout(); $this->assertNull($mock->getUser()); @@ -206,7 +206,7 @@ public function testLoginMethodQueuesCookieWhenRemembering() $foreverCookie = new Symfony\Component\HttpFoundation\Cookie($guard->getRecallerName(), 'foo'); $cookie->shouldReceive('forever')->once()->with($guard->getRecallerName(), 'foo|recaller')->andReturn($foreverCookie); $cookie->shouldReceive('queue')->once()->with($foreverCookie); - $guard->getSession()->shouldReceive('put')->once()->with($guard->getName(), 'foo'); + $guard->getSession()->shouldReceive('set')->once()->with($guard->getName(), 'foo'); $session->shouldReceive('migrate')->once(); $user = m::mock('Illuminate\Contracts\Auth\User'); $user->shouldReceive('getAuthIdentifier')->andReturn('foo'); @@ -225,7 +225,7 @@ public function testLoginMethodCreatesRememberTokenIfOneDoesntExist() $foreverCookie = new Symfony\Component\HttpFoundation\Cookie($guard->getRecallerName(), 'foo'); $cookie->shouldReceive('forever')->once()->andReturn($foreverCookie); $cookie->shouldReceive('queue')->once()->with($foreverCookie); - $guard->getSession()->shouldReceive('put')->once()->with($guard->getName(), 'foo'); + $guard->getSession()->shouldReceive('set')->once()->with($guard->getName(), 'foo'); $session->shouldReceive('migrate')->once(); $user = m::mock('Illuminate\Contracts\Auth\User'); $user->shouldReceive('getAuthIdentifier')->andReturn('foo'); @@ -240,7 +240,7 @@ public function testLoginUsingIdStoresInSessionAndLogsInWithUser() { list($session, $provider, $request, $cookie) = $this->getMocks(); $guard = $this->getMock('Illuminate\Auth\Guard', array('login', 'user'), array($provider, $session, $request)); - $guard->getSession()->shouldReceive('put')->once()->with($guard->getName(), 10); + $guard->getSession()->shouldReceive('set')->once()->with($guard->getName(), 10); $guard->getProvider()->shouldReceive('retrieveById')->once()->with(10)->andReturn($user = m::mock('Illuminate\Contracts\Auth\User')); $guard->expects($this->once())->method('login')->with($this->equalTo($user), $this->equalTo(false))->will($this->returnValue($user)); @@ -272,7 +272,7 @@ protected function getGuard() protected function getMocks() { return array( - m::mock('Illuminate\Session\Store'), + m::mock('Symfony\Component\HttpFoundation\Session\SessionInterface'), m::mock('Illuminate\Auth\UserProviderInterface'), Symfony\Component\HttpFoundation\Request::create('/', 'GET'), m::mock('Illuminate\Cookie\CookieJar'),
false
Other
laravel
framework
e38cf45df8ec077134de79987c2b9d566fceb257.json
Add tests for URL::previous().
tests/Routing/RoutingUrlGeneratorTest.php
@@ -235,4 +235,19 @@ public function testForceRootUrl() $this->assertEquals('https://www.bar.com/foo', $url->route('plain')); } + + public function testPrevious() + { + $url = new UrlGenerator( + $routes = new Illuminate\Routing\RouteCollection, + $request = Illuminate\Http\Request::create('http://www.foo.com/') + ); + + $url->getRequest()->headers->set('referer', 'http://www.bar.com/'); + $this->assertEquals('http://www.bar.com/', $url->previous()); + + $url->getRequest()->headers->remove('referer'); + $this->assertEquals($url->to('/'), $url->previous()); + } + }
false
Other
laravel
framework
6f834cef68a1dbd17df4fd51c76c8d157d9900a8.json
Extend app request by default.
src/Illuminate/Foundation/Console/stubs/request.stub
@@ -1,8 +1,8 @@ <?php namespace {{namespace}}; -use Illuminate\Foundation\Http\FormRequest; +use {{rootNamespace}}Http\Requests\Request; -class {{class}} extends FormRequest { +class {{class}} extends Request { /** * Get the validation rules that apply to the request.
false
Other
laravel
framework
157821620597c7d19e5ffc3f61a5902fdeeeb4a9.json
Extend base controller by default.
src/Illuminate/Console/GeneratorCommand.php
@@ -146,6 +146,10 @@ protected function replaceNamespace(&$stub, $name) '{{namespace}}', $this->getNamespace($name), $stub ); + $stub = str_replace( + '{{rootNamespace}}', $this->getAppNamespace(), $stub + ); + return $this; }
true
Other
laravel
framework
157821620597c7d19e5ffc3f61a5902fdeeeb4a9.json
Extend base controller by default.
src/Illuminate/Routing/Console/stubs/controller.plain.stub
@@ -1,6 +1,6 @@ <?php namespace {{namespace}}; -use Illuminate\Routing\Controller; +use {{rootNamespace}}Http\Controllers\Controller; class {{class}} extends Controller {
true
Other
laravel
framework
157821620597c7d19e5ffc3f61a5902fdeeeb4a9.json
Extend base controller by default.
src/Illuminate/Routing/Console/stubs/controller.stub
@@ -1,6 +1,6 @@ <?php namespace {{namespace}}; -use Illuminate\Routing\Controller; +use {{rootNamespace}}Http\Controllers\Controller; class {{class}} extends Controller {
true
Other
laravel
framework
2bf2b1680b7d70a9ed9aa11ac271e10c26ccc4c7.json
Simplify log levels
src/Illuminate/Log/Writer.php
@@ -28,6 +28,22 @@ class Writer implements LogContract, PsrLoggerInterface { */ protected $dispatcher; + /** + * The Log levels. + * + * @var array + */ + protected $levels = [ + 'debug' => MonologLogger::DEBUG, + 'info' => MonologLogger::INFO, + 'notice' => MonologLogger::NOTICE, + 'warning' => MonologLogger::WARNING, + 'error' => MonologLogger::ERROR, + 'critical' => MonologLogger::CRITICAL, + 'alert' => MonologLogger::ALERT, + 'emergency' => MonologLogger::EMERGENCY, + ]; + /** * Create a new log writer instance. * @@ -300,35 +316,10 @@ protected function formatMessage($message) */ protected function parseLevel($level) { - switch ($level) + return array_get($this->levels, $level, function () { - case 'debug': - return MonologLogger::DEBUG; - - case 'info': - return MonologLogger::INFO; - - case 'notice': - return MonologLogger::NOTICE; - - case 'warning': - return MonologLogger::WARNING; - - case 'error': - return MonologLogger::ERROR; - - case 'critical': - return MonologLogger::CRITICAL; - - case 'alert': - return MonologLogger::ALERT; - - case 'emergency': - return MonologLogger::EMERGENCY; - - default: - throw new \InvalidArgumentException("Invalid log level."); - } + throw new \InvalidArgumentException("Invalid log level."); + }); } /**
false
Other
laravel
framework
a703c4d5397ac1bebf03e4d16453023e3743ee7a.json
Add test case, Fix inconsistent indentation
src/Illuminate/Validation/Validator.php
@@ -316,27 +316,27 @@ protected function validate($attribute, $rule) } /** - * Returns the data which was valid. - * + * Returns the data which was valid. + * * @return array */ public function valid() { if ( ! $this->messages) $this->passes(); - return array_diff_key($this->data, $this->messages()->toArray()); + return array_diff_key($this->data, $this->messages()->toArray()); } /** - * Returns the data which was invalid. - * + * Returns the data which was invalid. + * * @return array */ public function invalid() { if ( ! $this->messages) $this->passes(); - return array_intersect_key($this->data, $this->messages()->toArray()); + return array_intersect_key($this->data, $this->messages()->toArray()); } /** @@ -368,7 +368,7 @@ protected function getValue($attribute) protected function isValidatable($rule, $attribute, $value) { return $this->presentOrRuleIsImplicit($rule, $attribute, $value) && - $this->passesOptionalCheck($attribute); + $this->passesOptionalCheck($attribute); } /** @@ -395,8 +395,8 @@ protected function passesOptionalCheck($attribute) if ($this->hasRule($attribute, array('Sometimes'))) { return array_key_exists($attribute, array_dot($this->data)) - || in_array($attribute, array_keys($this->data)) - || array_key_exists($attribute, $this->files); + || in_array($attribute, array_keys($this->data)) + || array_key_exists($attribute, $this->files); } return true;
true
Other
laravel
framework
a703c4d5397ac1bebf03e4d16453023e3743ee7a.json
Add test case, Fix inconsistent indentation
tests/Validation/ValidationValidatorTest.php
@@ -24,6 +24,17 @@ public function testSometimesWorksOnNestedArrays() $this->assertTrue($v->passes()); } + public function testSometimesWorksOnArrays() + { + $trans = $this->getRealTranslator(); + $v = new Validator($trans, array('foo' => array('bar', 'baz', 'moo')), array('foo' => 'sometimes|required|between:5,10')); + $this->assertFalse($v->passes()); + $this->assertNotEmpty($v->failed()); + + $trans = $this->getRealTranslator(); + $v = new Validator($trans, array('foo' => array('bar', 'baz', 'moo', 'pew', 'boom')), array('foo' => 'sometimes|required|between:5,10')); + $this->assertTrue($v->passes()); + } public function testHasFailedValidationRules() {
true
Other
laravel
framework
f622f516740371b6217d36448f04d407a7594c3f.json
Add controller inspector.
src/Illuminate/Routing/ControllerInspector.php
@@ -0,0 +1,131 @@ +<?php namespace Illuminate\Routing; + +use ReflectionClass, ReflectionMethod; + +class ControllerInspector { + + /** + * An array of HTTP verbs. + * + * @var array + */ + protected $verbs = array( + 'any', 'get', 'post', 'put', 'patch', + 'delete', 'head', 'options' + ); + + /** + * Get the routable methods for a controller. + * + * @param string $controller + * @param string $prefix + * @return array + */ + public function getRoutable($controller, $prefix) + { + $routable = array(); + + $reflection = new ReflectionClass($controller); + + $methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC); + + // To get the routable methods, we will simply spin through all methods on the + // controller instance checking to see if it belongs to the given class and + // is a publicly routable method. If so, we will add it to this listings. + foreach ($methods as $method) + { + if ($this->isRoutable($method)) + { + $data = $this->getMethodData($method, $prefix); + + $routable[$method->name][] = $data; + + // If the routable method is an index method, we will create a special index + // route which is simply the prefix and the verb and does not contain any + // the wildcard place-holders that each "typical" routes would contain. + if ($data['plain'] == $prefix.'/index') + { + $routable[$method->name][] = $this->getIndexData($data, $prefix); + } + } + } + + return $routable; + } + + /** + * Determine if the given controller method is routable. + * + * @param \ReflectionMethod $method + * @return bool + */ + public function isRoutable(ReflectionMethod $method) + { + if ($method->class == 'Illuminate\Routing\Controller') return false; + + return starts_with($method->name, $this->verbs); + } + + /** + * Get the method data for a given method. + * + * @param \ReflectionMethod $method + * @param string $prefix + * @return array + */ + public function getMethodData(ReflectionMethod $method, $prefix) + { + $verb = $this->getVerb($name = $method->name); + + $uri = $this->addUriWildcards($plain = $this->getPlainUri($name, $prefix)); + + return compact('verb', 'plain', 'uri'); + } + + /** + * Get the routable data for an index method. + * + * @param array $data + * @param string $prefix + * @return array + */ + protected function getIndexData($data, $prefix) + { + return array('verb' => $data['verb'], 'plain' => $prefix, 'uri' => $prefix); + } + + /** + * Extract the verb from a controller action. + * + * @param string $name + * @return string + */ + public function getVerb($name) + { + return head(explode('_', snake_case($name))); + } + + /** + * Determine the URI from the given method name. + * + * @param string $name + * @param string $prefix + * @return string + */ + public function getPlainUri($name, $prefix) + { + return $prefix.'/'.implode('-', array_slice(explode('_', snake_case($name)), 1)); + } + + /** + * Add wildcards to the given URI. + * + * @param string $uri + * @return string + */ + public function addUriWildcards($uri) + { + return $uri.'/{one?}/{two?}/{three?}/{four?}/{five?}'; + } + +}
true
Other
laravel
framework
f622f516740371b6217d36448f04d407a7594c3f.json
Add controller inspector.
src/Illuminate/Routing/Router.php
@@ -209,6 +209,92 @@ public function match($methods, $uri, $action) return $this->addRoute(array_map('strtoupper', (array) $methods), $uri, $action); } + /** + * Register an array of controllers with wildcard routing. + * + * @param array $controllers + * @return void + */ + public function controllers(array $controllers) + { + foreach ($controllers as $uri => $name) + { + $this->controller($uri, $name); + } + } + + /** + * Route a controller to a URI with wildcard routing. + * + * @param string $uri + * @param string $controller + * @param array $names + * @return void + */ + public function controller($uri, $controller, $names = array()) + { + $prepended = $controller; + + // First, we will check to see if a controller prefix has been registered in + // the route group. If it has, we will need to prefix it before trying to + // reflect into the class instance and pull out the method for routing. + if ( ! empty($this->groupStack)) + { + $prepended = $this->prependGroupUses($controller); + } + + $routable = (new ControllerInspector) + ->getRoutable($prepended, $uri); + + // When a controller is routed using this method, we use Reflection to parse + // out all of the routable methods for the controller, then register each + // route explicitly for the developers, so reverse routing is possible. + foreach ($routable as $method => $routes) + { + foreach ($routes as $route) + { + $this->registerInspected($route, $controller, $method, $names); + } + } + + $this->addFallthroughRoute($controller, $uri); + } + + /** + * Register an inspected controller route. + * + * @param array $route + * @param string $controller + * @param string $method + * @param array $names + * @return void + */ + protected function registerInspected($route, $controller, $method, &$names) + { + $action = array('uses' => $controller.'@'.$method); + + // If a given controller method has been named, we will assign the name to the + // controller action array, which provides for a short-cut to method naming + // so you don't have to define an individual route for these controllers. + $action['as'] = array_get($names, $method); + + $this->{$route['verb']}($route['uri'], $action); + } + + /** + * Add a fallthrough route for a controller. + * + * @param string $controller + * @param string $uri + * @return void + */ + protected function addFallthroughRoute($controller, $uri) + { + $missing = $this->any($uri.'/{_missing}', $controller.'@missingMethod'); + + $missing->where('_missing', '(.*)'); + } + /** * Route a resource to a controller. *
true
Other
laravel
framework
f622f516740371b6217d36448f04d407a7594c3f.json
Add controller inspector.
tests/Routing/RoutingRouteTest.php
@@ -794,6 +794,14 @@ public function testControllerRouting() } + public function testControllerInspection() + { + $router = $this->getRouter(); + $router->controller('home', 'RouteTestInspectedControllerStub'); + $this->assertEquals('hello', $router->dispatch(Request::create('home/foo', 'GET'))->getContent()); + } + + protected function getRouter() { return new Router(new Illuminate\Events\Dispatcher); @@ -823,6 +831,12 @@ public function handle($request, $next) } } +class RouteTestInspectedControllerStub extends Illuminate\Routing\Controller { + public function getFoo() + { + return 'hello'; + } +} class RouteTestControllerExceptMiddleware { public function handle($request, $next)
true
Other
laravel
framework
0b5df4c72fef7455b2511bb10fd925dc2f96b68f.json
Fix a bug that Validator bypasses array checking For checking array with “sometimes” Validator calls function passesOptionalCheck to check if attribute key is set. “passesOptionalCheck” uses array_dot to flatten the input data, so for input like “items”: [“good1”, “good2”, “good3”] become array(“items.0” => “good1”, “items.1” => “good2”, “items.2” => “good3”). Checking attribute with array_key_exists here will always return false and validation is skipped
src/Illuminate/Validation/Validator.php
@@ -395,6 +395,7 @@ protected function passesOptionalCheck($attribute) if ($this->hasRule($attribute, array('Sometimes'))) { return array_key_exists($attribute, array_dot($this->data)) + || in_array($attribute, array_keys($this->data)) || array_key_exists($attribute, $this->files); }
false
Other
laravel
framework
8dece94eedeb6c743f805ab5e8a0cf90c2ca512d.json
Resolve commands in Artisan.
src/Illuminate/Foundation/Console/Kernel.php
@@ -119,7 +119,8 @@ protected function getArtisan() { if (is_null($this->artisan)) { - return $this->artisan = new Artisan($this->app, $this->events); + return $this->artisan = (new Artisan($this->app, $this->events)) + ->resolveCommands($this->commands); } return $this->artisan;
false
Other
laravel
framework
a0fb014043e945e2c91ff0cd346834ea4afe4524.json
Remove unused $changeHistory variable
src/Illuminate/Foundation/Testing/ApplicationTrait.php
@@ -98,7 +98,7 @@ public function route($method, $name, $routeParameters = [], $parameters = [], $ { $uri = $this->app['url']->route($name, $routeParameters); - return $this->call($method, $uri, $parameters, $cookies, $files, $server, $content, $changeHistory); + return $this->call($method, $uri, $parameters, $cookies, $files, $server, $content); } /**
false
Other
laravel
framework
6980562a507693630bc7572c9756c0dee4a0ce7c.json
Use Container contract.
src/Illuminate/Database/Connectors/ConnectionFactory.php
@@ -1,7 +1,7 @@ <?php namespace Illuminate\Database\Connectors; use PDO; -use Illuminate\Container\Container; +use Illuminate\Contracts\Container\Container; use Illuminate\Database\MySqlConnection; use Illuminate\Database\SQLiteConnection; use Illuminate\Database\PostgresConnection; @@ -12,14 +12,14 @@ class ConnectionFactory { /** * The IoC container instance. * - * @var \Illuminate\Container\Container + * @var \Illuminate\Contracts\Container\Container */ protected $container; /** * Create a new connection factory instance. * - * @param \Illuminate\Container\Container $container + * @param \Illuminate\Contracts\Container\Container $container * @return void */ public function __construct(Container $container)
false
Other
laravel
framework
d8f8dd669b6f241192e287907a0e215be028a05c.json
Add methods to the validation factory contract.
src/Illuminate/Contracts/Validation/Factory.php
@@ -13,4 +13,33 @@ interface Factory { */ public function make(array $data, array $rules, array $messages = array(), array $customAttributes = array()); + /** + * Register a custom validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @param string $message + * @return void + */ + public function extend($rule, $extension, $message = null); + + /** + * Register a custom implicit validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @param string $message + * @return void + */ + public function extendImplicit($rule, $extension, $message = null); + + /** + * Register a custom implicit validator message replacer. + * + * @param string $rule + * @param \Closure|string $replacer + * @return void + */ + public function replacer($rule, $replacer); + }
false
Other
laravel
framework
b7b632c2538209a4c4ba8f7407f678ade9256dd5.json
Remove leftover variable.
src/Illuminate/Database/DatabaseManager.php
@@ -191,9 +191,6 @@ protected function prepare(Connection $connection) $connection->setEventDispatcher($this->app['events']); } - $app = $this->app; - - // Here we'll set a reconnector callback. This reconnector can be any callable // so we will set a Closure to reconnect from this manager with the name of // the connection, which will allow us to reconnect from the connections.
false
Other
laravel
framework
7c827d0d2226e4e0788852a7d3837d128081c090.json
Use Container contract, add class member.
src/Illuminate/Validation/Validator.php
@@ -5,7 +5,7 @@ use DateTimeZone; use Illuminate\Support\Fluent; use Illuminate\Support\MessageBag; -use Illuminate\Container\Container; +use Illuminate\Contracts\Container\Container; use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\HttpFoundation\File\UploadedFile; @@ -27,6 +27,13 @@ class Validator implements ValidatorContract { */ protected $presenceVerifier; + /** + * The container instance. + * + * @var \Illuminate\Contracts\Container\Container + */ + protected $container; + /** * The failed validation rules. * @@ -2434,7 +2441,7 @@ public function getMessageBag() /** * Set the IoC container instance. * - * @param \Illuminate\Container\Container $container + * @param \Illuminate\Contracts\Container\Container $container * @return void */ public function setContainer(Container $container)
false
Other
laravel
framework
84cfbb7ea0d5d5e774ef4a7029d3e5932601eb0a.json
Use Container contract.
src/Illuminate/Validation/Factory.php
@@ -1,7 +1,7 @@ <?php namespace Illuminate\Validation; use Closure; -use Illuminate\Container\Container; +use Illuminate\Contracts\Container\Container; use Symfony\Component\Translation\TranslatorInterface; use Illuminate\Contracts\Validation\Factory as FactoryContract; @@ -24,7 +24,7 @@ class Factory implements FactoryContract { /** * The IoC container instance. * - * @var \Illuminate\Container\Container + * @var \Illuminate\Contracts\Container\Container */ protected $container; @@ -67,7 +67,7 @@ class Factory implements FactoryContract { * Create a new Validator factory instance. * * @param \Symfony\Component\Translation\TranslatorInterface $translator - * @param \Illuminate\Container\Container $container + * @param \Illuminate\Contracts\Container\Container $container * @return void */ public function __construct(TranslatorInterface $translator, Container $container = null)
false
Other
laravel
framework
79c1d50b4e53ab00a38b5c2e443fce88ee1fb528.json
Fix various docblocks
src/Illuminate/Console/AppNamespaceDetectorTrait.php
@@ -5,8 +5,9 @@ trait AppNamespaceDetectorTrait { /** * Get the application namespace from the Composer file. * - * @param string $namespacePath * @return string + * + * @throws \RuntimeException */ protected function getAppNamespace() {
true
Other
laravel
framework
79c1d50b4e53ab00a38b5c2e443fce88ee1fb528.json
Fix various docblocks
src/Illuminate/Events/Annotations/Annotations/Hears.php
@@ -15,6 +15,7 @@ class Hears { /** * Create a new annotation instance. * + * @param array $values * @return void */ public function __construct(array $values = array())
true
Other
laravel
framework
79c1d50b4e53ab00a38b5c2e443fce88ee1fb528.json
Fix various docblocks
src/Illuminate/Events/Annotations/Scanner.php
@@ -90,9 +90,12 @@ protected function getClassesToScan() foreach ($this->scan as $class) { - try { + try + { $classes[] = new ReflectionClass($class); - } catch (\Exception $e) { + } + catch (\Exception $e) + { // } }
true
Other
laravel
framework
9b8490e5c568436748ed142b594879c3e5a90db0.json
Bind request before routing again.
src/Illuminate/Foundation/Http/Kernel.php
@@ -94,6 +94,8 @@ protected function dispatchToRouter() { return function($request) { + $this->app->instance('request', $request); + return $this->router->dispatch($request); }; }
false
Other
laravel
framework
beaa9206d6cf919527a63eb5cf0ad81315531bfb.json
Remove extra line
tests/Http/HttpRequestTest.php
@@ -365,7 +365,6 @@ public function testInputWithEmptyFilename() $request = Request::createFromBase($baseRequest); } - public function testOldMethodCallsSession() { $request = Request::create('/', 'GET');
false
Other
laravel
framework
ff3df6773e74fd9dd61a3b7b44b50b2b793f5e11.json
Use contract for MessageBag
src/Illuminate/Support/ViewErrorBag.php
@@ -1,6 +1,7 @@ <?php namespace Illuminate\Support; use Countable; +use Illuminate\Contracts\Support\MessageBag as MessageBagContract; class ViewErrorBag implements Countable { @@ -26,7 +27,7 @@ public function hasBag($key = 'default') * Get a MessageBag instance from the bags. * * @param string $key - * @return \Illuminate\Support\MessageBag + * @return \Illuminate\Contracts\Support\MessageBag */ public function getBag($key) { @@ -37,10 +38,10 @@ public function getBag($key) * Add a new MessageBag instance to the bags. * * @param string $key - * @param \Illuminate\Support\MessageBag $bag + * @param \Illuminate\Contracts\Support\MessageBag $bag * @return $this */ - public function put($key, MessageBag $bag) + public function put($key, MessageBagContract $bag) { $this->bags[$key] = $bag; @@ -73,7 +74,7 @@ public function __call($method, $parameters) * Dynamically access a view error bag. * * @param string $key - * @return \Illuminate\Support\MessageBag + * @return \Illuminate\Contracts\Support\MessageBag */ public function __get($key) { @@ -84,7 +85,7 @@ public function __get($key) * Dynamically set a view error bag. * * @param string $key - * @param \Illuminate\Support\MessageBag $value + * @param \Illuminate\Contracts\Support\MessageBag $value * @return void */ public function __set($key, $value)
false
Other
laravel
framework
11b0550b344fea355d7802f2dfaea01c40d2ecdb.json
Return response from mailgun
src/Illuminate/Mail/Transport/MailgunTransport.php
@@ -74,7 +74,7 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) { $client = $this->getHttpClient(); - $client->post($this->url, ['auth' => ['api', $this->key], + return $client->post($this->url, ['auth' => ['api', $this->key], 'body' => [ 'to' => $this->getTo($message), 'message' => new PostFile('message', (string) $message),
false
Other
laravel
framework
714d179be206f9506e819db332036098cd15f4a7.json
Return response from mandrill
src/Illuminate/Mail/Transport/MandrillTransport.php
@@ -56,7 +56,7 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) { $client = $this->getHttpClient(); - $client->post('https://mandrillapp.com/api/1.0/messages/send-raw.json', [ + return $client->post('https://mandrillapp.com/api/1.0/messages/send-raw.json', [ 'body' => [ 'key' => $this->key, 'raw_message' => (string) $message,
false
Other
laravel
framework
4036d0becae1e5fedbcb86eda44bb756dff44d8a.json
Use contract for event dispatcher
src/Illuminate/Events/Dispatcher.php
@@ -2,13 +2,14 @@ use Illuminate\Container\Container; use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; +use Illuminate\Contracts\Container\Container as ContainerContract; class Dispatcher implements DispatcherContract { /** * The IoC container instance. * - * @var \Illuminate\Container\Container + * @var \Illuminate\Contracts\Container\Container */ protected $container; @@ -43,10 +44,10 @@ class Dispatcher implements DispatcherContract { /** * Create a new event dispatcher instance. * - * @param \Illuminate\Container\Container $container + * @param \Illuminate\Contracts\Container\Container $container * @return void */ - public function __construct(Container $container = null) + public function __construct(ContainerContract $container = null) { $this->container = $container ?: new Container; }
false