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
078697196e7f7f6c3315c8657ec2fb2310c4d423.json
Fix selected columns on hasManyThrough
tests/Database/DatabaseEloquentHasManyThroughTest.php
@@ -66,6 +66,43 @@ public function testModelsAreProperlyMatchedToParents() } + public function testAllColumnsAreSelectedByDefault() + { + $select = array('posts.*', 'users.country_id'); + + $baseBuilder = m::mock('Illuminate\Database\Query\Builder'); + + $relation = $this->getRelation(); + $relation->getRelated()->shouldReceive('newCollection')->once(); + + $builder = $relation->getQuery(); + $builder->shouldReceive('getQuery')->andReturn($baseBuilder); + $builder->shouldReceive('addSelect')->once()->with($select)->andReturn($builder); + $builder->shouldReceive('getModels')->once()->andReturn(array()); + + $relation->get(); + } + + + public function testOnlyProperColumnsAreSelectedIfProvided() + { + $select = array('users.country_id'); + + $baseBuilder = m::mock('Illuminate\Database\Query\Builder'); + $baseBuilder->columns = array('foo', 'bar'); + + $relation = $this->getRelation(); + $relation->getRelated()->shouldReceive('newCollection')->once(); + + $builder = $relation->getQuery(); + $builder->shouldReceive('getQuery')->andReturn($baseBuilder); + $builder->shouldReceive('addSelect')->once()->with($select)->andReturn($builder); + $builder->shouldReceive('getModels')->once()->andReturn(array()); + + $relation->get(); + } + + protected function getRelation() { $builder = m::mock('Illuminate\Database\Eloquent\Builder');
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Hashing/HashServiceProvider.php
@@ -1,34 +1,34 @@ -<?php namespace Illuminate\Hashing; - -use Illuminate\Support\ServiceProvider; - -class HashServiceProvider extends ServiceProvider { - - /** - * Indicates if loading of the provider is deferred. - * - * @var bool - */ - protected $defer = true; - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->app->singleton('hash', function() { return new BcryptHasher; }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('hash'); - } - -} +<?php namespace Illuminate\Hashing; + +use Illuminate\Support\ServiceProvider; + +class HashServiceProvider extends ServiceProvider { + + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('hash', function() { return new BcryptHasher; }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return array('hash'); + } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Pagination/PaginationServiceProvider.php
@@ -1,25 +1,25 @@ -<?php namespace Illuminate\Pagination; - -use Illuminate\Support\ServiceProvider; - -class PaginationServiceProvider extends ServiceProvider { - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - Paginator::currentPathResolver(function() - { - return $this->app['request']->url(); - }); - - Paginator::currentPageResolver(function() - { - return $this->app['request']->input('page'); - }); - } - -} +<?php namespace Illuminate\Pagination; + +use Illuminate\Support\ServiceProvider; + +class PaginationServiceProvider extends ServiceProvider { + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + Paginator::currentPathResolver(function() + { + return $this->app['request']->url(); + }); + + Paginator::currentPageResolver(function() + { + return $this->app['request']->input('page'); + }); + } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Queue/Console/ListenCommand.php
@@ -1,145 +1,145 @@ -<?php namespace Illuminate\Queue\Console; - -use Illuminate\Queue\Listener; -use Illuminate\Console\Command; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Input\InputArgument; - -class ListenCommand extends Command { - - /** - * The console command name. - * - * @var string - */ - protected $name = 'queue:listen'; - - /** - * The console command description. - * - * @var string - */ - protected $description = 'Listen to a given queue'; - - /** - * The queue listener instance. - * - * @var \Illuminate\Queue\Listener - */ - protected $listener; - - /** - * Create a new queue listen command. - * - * @param \Illuminate\Queue\Listener $listener - * @return void - */ - public function __construct(Listener $listener) - { - parent::__construct(); - - $this->listener = $listener; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->setListenerOptions(); - - $delay = $this->input->getOption('delay'); - - // The memory limit is the amount of memory we will allow the script to occupy - // before killing it and letting a process manager restart it for us, which - // is to protect us against any memory leaks that will be in the scripts. - $memory = $this->input->getOption('memory'); - - $connection = $this->input->getArgument('connection'); - - $timeout = $this->input->getOption('timeout'); - - // We need to get the right queue for the connection which is set in the queue - // configuration file for the application. We will pull it based on the set - // connection being run for the queue operation currently being executed. - $queue = $this->getQueue($connection); - - $this->listener->listen( - $connection, $queue, $delay, $memory, $timeout - ); - } - - /** - * Get the name of the queue connection to listen on. - * - * @param string $connection - * @return string - */ - protected function getQueue($connection) - { - if (is_null($connection)) - { - $connection = $this->laravel['config']['queue.default']; - } - - $queue = $this->laravel['config']->get("queue.connections.{$connection}.queue", 'default'); - - return $this->input->getOption('queue') ?: $queue; - } - - /** - * Set the options on the queue listener. - * - * @return void - */ - protected function setListenerOptions() - { - $this->listener->setEnvironment($this->laravel->environment()); - - $this->listener->setSleep($this->option('sleep')); - - $this->listener->setMaxTries($this->option('tries')); - - $this->listener->setOutputHandler(function($type, $line) - { - $this->output->write($line); - }); - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return array( - array('connection', InputArgument::OPTIONAL, 'The name of connection'), - ); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('queue', null, InputOption::VALUE_OPTIONAL, 'The queue to listen on', null), - - array('delay', null, InputOption::VALUE_OPTIONAL, 'Amount of time to delay failed jobs', 0), - - array('memory', null, InputOption::VALUE_OPTIONAL, 'The memory limit in megabytes', 128), - - array('timeout', null, InputOption::VALUE_OPTIONAL, 'Seconds a job may run before timing out', 60), - - array('sleep', null, InputOption::VALUE_OPTIONAL, 'Seconds to wait before checking queue for jobs', 3), - - array('tries', null, InputOption::VALUE_OPTIONAL, 'Number of times to attempt a job before logging it failed', 0), - ); - } - -} +<?php namespace Illuminate\Queue\Console; + +use Illuminate\Queue\Listener; +use Illuminate\Console\Command; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputArgument; + +class ListenCommand extends Command { + + /** + * The console command name. + * + * @var string + */ + protected $name = 'queue:listen'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Listen to a given queue'; + + /** + * The queue listener instance. + * + * @var \Illuminate\Queue\Listener + */ + protected $listener; + + /** + * Create a new queue listen command. + * + * @param \Illuminate\Queue\Listener $listener + * @return void + */ + public function __construct(Listener $listener) + { + parent::__construct(); + + $this->listener = $listener; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->setListenerOptions(); + + $delay = $this->input->getOption('delay'); + + // The memory limit is the amount of memory we will allow the script to occupy + // before killing it and letting a process manager restart it for us, which + // is to protect us against any memory leaks that will be in the scripts. + $memory = $this->input->getOption('memory'); + + $connection = $this->input->getArgument('connection'); + + $timeout = $this->input->getOption('timeout'); + + // We need to get the right queue for the connection which is set in the queue + // configuration file for the application. We will pull it based on the set + // connection being run for the queue operation currently being executed. + $queue = $this->getQueue($connection); + + $this->listener->listen( + $connection, $queue, $delay, $memory, $timeout + ); + } + + /** + * Get the name of the queue connection to listen on. + * + * @param string $connection + * @return string + */ + protected function getQueue($connection) + { + if (is_null($connection)) + { + $connection = $this->laravel['config']['queue.default']; + } + + $queue = $this->laravel['config']->get("queue.connections.{$connection}.queue", 'default'); + + return $this->input->getOption('queue') ?: $queue; + } + + /** + * Set the options on the queue listener. + * + * @return void + */ + protected function setListenerOptions() + { + $this->listener->setEnvironment($this->laravel->environment()); + + $this->listener->setSleep($this->option('sleep')); + + $this->listener->setMaxTries($this->option('tries')); + + $this->listener->setOutputHandler(function($type, $line) + { + $this->output->write($line); + }); + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return array( + array('connection', InputArgument::OPTIONAL, 'The name of connection'), + ); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return array( + array('queue', null, InputOption::VALUE_OPTIONAL, 'The queue to listen on', null), + + array('delay', null, InputOption::VALUE_OPTIONAL, 'Amount of time to delay failed jobs', 0), + + array('memory', null, InputOption::VALUE_OPTIONAL, 'The memory limit in megabytes', 128), + + array('timeout', null, InputOption::VALUE_OPTIONAL, 'Seconds a job may run before timing out', 60), + + array('sleep', null, InputOption::VALUE_OPTIONAL, 'Seconds to wait before checking queue for jobs', 3), + + array('tries', null, InputOption::VALUE_OPTIONAL, 'Number of times to attempt a job before logging it failed', 0), + ); + } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Redis/RedisServiceProvider.php
@@ -1,37 +1,37 @@ -<?php namespace Illuminate\Redis; - -use Illuminate\Support\ServiceProvider; - -class RedisServiceProvider extends ServiceProvider { - - /** - * Indicates if loading of the provider is deferred. - * - * @var bool - */ - protected $defer = true; - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->app->singleton('redis', function($app) - { - return new Database($app['config']['database.redis']); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('redis'); - } - -} +<?php namespace Illuminate\Redis; + +use Illuminate\Support\ServiceProvider; + +class RedisServiceProvider extends ServiceProvider { + + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('redis', function($app) + { + return new Database($app['config']['database.redis']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return array('redis'); + } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Routing/Matching/HostValidator.php
@@ -1,22 +1,22 @@ -<?php namespace Illuminate\Routing\Matching; - -use Illuminate\Http\Request; -use Illuminate\Routing\Route; - -class HostValidator implements ValidatorInterface { - - /** - * Validate a given rule against a route and request. - * - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @return bool - */ - public function matches(Route $route, Request $request) - { - if (is_null($route->getCompiled()->getHostRegex())) return true; - - return preg_match($route->getCompiled()->getHostRegex(), $request->getHost()); - } - -} +<?php namespace Illuminate\Routing\Matching; + +use Illuminate\Http\Request; +use Illuminate\Routing\Route; + +class HostValidator implements ValidatorInterface { + + /** + * Validate a given rule against a route and request. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return bool + */ + public function matches(Route $route, Request $request) + { + if (is_null($route->getCompiled()->getHostRegex())) return true; + + return preg_match($route->getCompiled()->getHostRegex(), $request->getHost()); + } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Routing/Matching/MethodValidator.php
@@ -1,20 +1,20 @@ -<?php namespace Illuminate\Routing\Matching; - -use Illuminate\Http\Request; -use Illuminate\Routing\Route; - -class MethodValidator implements ValidatorInterface { - - /** - * Validate a given rule against a route and request. - * - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @return bool - */ - public function matches(Route $route, Request $request) - { - return in_array($request->getMethod(), $route->methods()); - } - -} +<?php namespace Illuminate\Routing\Matching; + +use Illuminate\Http\Request; +use Illuminate\Routing\Route; + +class MethodValidator implements ValidatorInterface { + + /** + * Validate a given rule against a route and request. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return bool + */ + public function matches(Route $route, Request $request) + { + return in_array($request->getMethod(), $route->methods()); + } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Routing/Matching/SchemeValidator.php
@@ -1,29 +1,29 @@ -<?php namespace Illuminate\Routing\Matching; - -use Illuminate\Http\Request; -use Illuminate\Routing\Route; - -class SchemeValidator implements ValidatorInterface { - - /** - * Validate a given rule against a route and request. - * - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @return bool - */ - public function matches(Route $route, Request $request) - { - if ($route->httpOnly()) - { - return ! $request->secure(); - } - elseif ($route->secure()) - { - return $request->secure(); - } - - return true; - } - -} +<?php namespace Illuminate\Routing\Matching; + +use Illuminate\Http\Request; +use Illuminate\Routing\Route; + +class SchemeValidator implements ValidatorInterface { + + /** + * Validate a given rule against a route and request. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return bool + */ + public function matches(Route $route, Request $request) + { + if ($route->httpOnly()) + { + return ! $request->secure(); + } + elseif ($route->secure()) + { + return $request->secure(); + } + + return true; + } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Routing/Matching/UriValidator.php
@@ -1,22 +1,22 @@ -<?php namespace Illuminate\Routing\Matching; - -use Illuminate\Http\Request; -use Illuminate\Routing\Route; - -class UriValidator implements ValidatorInterface { - - /** - * Validate a given rule against a route and request. - * - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @return bool - */ - public function matches(Route $route, Request $request) - { - $path = $request->path() == '/' ? '/' : '/'.$request->path(); - - return preg_match($route->getCompiled()->getRegex(), rawurldecode($path)); - } - -} +<?php namespace Illuminate\Routing\Matching; + +use Illuminate\Http\Request; +use Illuminate\Routing\Route; + +class UriValidator implements ValidatorInterface { + + /** + * Validate a given rule against a route and request. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return bool + */ + public function matches(Route $route, Request $request) + { + $path = $request->path() == '/' ? '/' : '/'.$request->path(); + + return preg_match($route->getCompiled()->getRegex(), rawurldecode($path)); + } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Routing/Matching/ValidatorInterface.php
@@ -1,17 +1,17 @@ -<?php namespace Illuminate\Routing\Matching; - -use Illuminate\Http\Request; -use Illuminate\Routing\Route; - -interface ValidatorInterface { - - /** - * Validate a given rule against a route and request. - * - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @return bool - */ - public function matches(Route $route, Request $request); - -} +<?php namespace Illuminate\Routing\Matching; + +use Illuminate\Http\Request; +use Illuminate\Routing\Route; + +interface ValidatorInterface { + + /** + * Validate a given rule against a route and request. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return bool + */ + public function matches(Route $route, Request $request); + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Session/SessionManager.php
@@ -1,208 +1,208 @@ -<?php namespace Illuminate\Session; - -use Illuminate\Support\Manager; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; - -class SessionManager extends Manager { - - /** - * Call a custom driver creator. - * - * @param string $driver - * @return mixed - */ - protected function callCustomCreator($driver) - { - return $this->buildSession(parent::callCustomCreator($driver)); - } - - /** - * Create an instance of the "array" session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createArrayDriver() - { - return $this->buildSession(new NullSessionHandler); - } - - /** - * Create an instance of the "cookie" session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createCookieDriver() - { - $lifetime = $this->app['config']['session.lifetime']; - - return $this->buildSession(new CookieSessionHandler($this->app['cookie'], $lifetime)); - } - - /** - * Create an instance of the file session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createFileDriver() - { - return $this->createNativeDriver(); - } - - /** - * Create an instance of the file session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createNativeDriver() - { - $path = $this->app['config']['session.files']; - - return $this->buildSession(new FileSessionHandler($this->app['files'], $path)); - } - - /** - * Create an instance of the database session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createDatabaseDriver() - { - $connection = $this->getDatabaseConnection(); - - $table = $this->app['config']['session.table']; - - return $this->buildSession(new DatabaseSessionHandler($connection, $table)); - } - - /** - * Get the database connection for the database driver. - * - * @return \Illuminate\Database\Connection - */ - protected function getDatabaseConnection() - { - $connection = $this->app['config']['session.connection']; - - return $this->app['db']->connection($connection); - } - - /** - * Create an instance of the APC session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createApcDriver() - { - return $this->createCacheBased('apc'); - } - - /** - * Create an instance of the Memcached session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createMemcachedDriver() - { - return $this->createCacheBased('memcached'); - } - - /** - * Create an instance of the Wincache session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createWincacheDriver() - { - return $this->createCacheBased('wincache'); - } - - /** - * Create an instance of the Redis session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createRedisDriver() - { - $handler = $this->createCacheHandler('redis'); - - $handler->getCache()->getStore()->setConnection($this->app['config']['session.connection']); - - return $this->buildSession($handler); - } - - /** - * Create an instance of a cache driven driver. - * - * @param string $driver - * @return \Illuminate\Session\Store - */ - protected function createCacheBased($driver) - { - return $this->buildSession($this->createCacheHandler($driver)); - } - - /** - * Create the cache based session handler instance. - * - * @param string $driver - * @return \Illuminate\Session\CacheBasedSessionHandler - */ - protected function createCacheHandler($driver) - { - $minutes = $this->app['config']['session.lifetime']; - - return new CacheBasedSessionHandler($this->app['cache']->driver($driver), $minutes); - } - - /** - * Build the session instance. - * - * @param \SessionHandlerInterface $handler - * @return \Illuminate\Session\Store - */ - protected function buildSession($handler) - { - if ($this->app['config']['session.encrypt']) - { - return new EncryptedStore( - $this->app['config']['session.cookie'], $handler, $this->app['encrypter'] - ); - } - else - { - return new Store($this->app['config']['session.cookie'], $handler); - } - } - - /** - * Get the session configuration. - * - * @return array - */ - public function getSessionConfig() - { - return $this->app['config']['session']; - } - - /** - * Get the default session driver name. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->app['config']['session.driver']; - } - - /** - * Set the default session driver name. - * - * @param string $name - * @return void - */ - public function setDefaultDriver($name) - { - $this->app['config']['session.driver'] = $name; - } - -} +<?php namespace Illuminate\Session; + +use Illuminate\Support\Manager; +use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; + +class SessionManager extends Manager { + + /** + * Call a custom driver creator. + * + * @param string $driver + * @return mixed + */ + protected function callCustomCreator($driver) + { + return $this->buildSession(parent::callCustomCreator($driver)); + } + + /** + * Create an instance of the "array" session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createArrayDriver() + { + return $this->buildSession(new NullSessionHandler); + } + + /** + * Create an instance of the "cookie" session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createCookieDriver() + { + $lifetime = $this->app['config']['session.lifetime']; + + return $this->buildSession(new CookieSessionHandler($this->app['cookie'], $lifetime)); + } + + /** + * Create an instance of the file session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createFileDriver() + { + return $this->createNativeDriver(); + } + + /** + * Create an instance of the file session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createNativeDriver() + { + $path = $this->app['config']['session.files']; + + return $this->buildSession(new FileSessionHandler($this->app['files'], $path)); + } + + /** + * Create an instance of the database session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createDatabaseDriver() + { + $connection = $this->getDatabaseConnection(); + + $table = $this->app['config']['session.table']; + + return $this->buildSession(new DatabaseSessionHandler($connection, $table)); + } + + /** + * Get the database connection for the database driver. + * + * @return \Illuminate\Database\Connection + */ + protected function getDatabaseConnection() + { + $connection = $this->app['config']['session.connection']; + + return $this->app['db']->connection($connection); + } + + /** + * Create an instance of the APC session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createApcDriver() + { + return $this->createCacheBased('apc'); + } + + /** + * Create an instance of the Memcached session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createMemcachedDriver() + { + return $this->createCacheBased('memcached'); + } + + /** + * Create an instance of the Wincache session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createWincacheDriver() + { + return $this->createCacheBased('wincache'); + } + + /** + * Create an instance of the Redis session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createRedisDriver() + { + $handler = $this->createCacheHandler('redis'); + + $handler->getCache()->getStore()->setConnection($this->app['config']['session.connection']); + + return $this->buildSession($handler); + } + + /** + * Create an instance of a cache driven driver. + * + * @param string $driver + * @return \Illuminate\Session\Store + */ + protected function createCacheBased($driver) + { + return $this->buildSession($this->createCacheHandler($driver)); + } + + /** + * Create the cache based session handler instance. + * + * @param string $driver + * @return \Illuminate\Session\CacheBasedSessionHandler + */ + protected function createCacheHandler($driver) + { + $minutes = $this->app['config']['session.lifetime']; + + return new CacheBasedSessionHandler($this->app['cache']->driver($driver), $minutes); + } + + /** + * Build the session instance. + * + * @param \SessionHandlerInterface $handler + * @return \Illuminate\Session\Store + */ + protected function buildSession($handler) + { + if ($this->app['config']['session.encrypt']) + { + return new EncryptedStore( + $this->app['config']['session.cookie'], $handler, $this->app['encrypter'] + ); + } + else + { + return new Store($this->app['config']['session.cookie'], $handler); + } + } + + /** + * Get the session configuration. + * + * @return array + */ + public function getSessionConfig() + { + return $this->app['config']['session']; + } + + /** + * Get the default session driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['session.driver']; + } + + /** + * Set the default session driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['session.driver'] = $name; + } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Session/SessionServiceProvider.php
@@ -1,52 +1,52 @@ -<?php namespace Illuminate\Session; - -use Illuminate\Support\ServiceProvider; - -class SessionServiceProvider extends ServiceProvider { - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->registerSessionManager(); - - $this->registerSessionDriver(); - - $this->app->singleton('Illuminate\Session\Middleware\StartSession'); - } - - /** - * Register the session manager instance. - * - * @return void - */ - protected function registerSessionManager() - { - $this->app->singleton('session', function($app) - { - return new SessionManager($app); - }); - } - - /** - * Register the session driver instance. - * - * @return void - */ - protected function registerSessionDriver() - { - $this->app->singleton('session.store', function($app) - { - // First, we will create the session manager which is responsible for the - // creation of the various session drivers when they are needed by the - // application instance, and will resolve them on a lazy load basis. - $manager = $app['session']; - - return $manager->driver(); - }); - } - -} +<?php namespace Illuminate\Session; + +use Illuminate\Support\ServiceProvider; + +class SessionServiceProvider extends ServiceProvider { + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerSessionManager(); + + $this->registerSessionDriver(); + + $this->app->singleton('Illuminate\Session\Middleware\StartSession'); + } + + /** + * Register the session manager instance. + * + * @return void + */ + protected function registerSessionManager() + { + $this->app->singleton('session', function($app) + { + return new SessionManager($app); + }); + } + + /** + * Register the session driver instance. + * + * @return void + */ + protected function registerSessionDriver() + { + $this->app->singleton('session.store', function($app) + { + // First, we will create the session manager which is responsible for the + // creation of the various session drivers when they are needed by the + // application instance, and will resolve them on a lazy load basis. + $manager = $app['session']; + + return $manager->driver(); + }); + } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/App.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Foundation\Application - */ -class App extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'app'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Foundation\Application + */ +class App extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'app'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Artisan.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Foundation\Artisan - */ -class Artisan extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'Illuminate\Contracts\Console\Kernel'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Foundation\Artisan + */ +class Artisan extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'Illuminate\Contracts\Console\Kernel'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Auth.php
@@ -1,16 +1,16 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Auth\AuthManager - * @see \Illuminate\Auth\Guard - */ -class Auth extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'auth'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Auth\AuthManager + * @see \Illuminate\Auth\Guard + */ +class Auth extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'auth'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Cache.php
@@ -1,16 +1,16 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Cache\CacheManager - * @see \Illuminate\Cache\Repository - */ -class Cache extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'cache'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Cache\CacheManager + * @see \Illuminate\Cache\Repository + */ +class Cache extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'cache'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Config.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Config\Repository - */ -class Config extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'config'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Config\Repository + */ +class Config extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'config'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Cookie.php
@@ -1,38 +1,38 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Cookie\CookieJar - */ -class Cookie extends Facade { - - /** - * Determine if a cookie exists on the request. - * - * @param string $key - * @return bool - */ - public static function has($key) - { - return ! is_null(static::$app['request']->cookie($key, null)); - } - - /** - * Retrieve a cookie from the request. - * - * @param string $key - * @param mixed $default - * @return string - */ - public static function get($key = null, $default = null) - { - return static::$app['request']->cookie($key, $default); - } - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'cookie'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Cookie\CookieJar + */ +class Cookie extends Facade { + + /** + * Determine if a cookie exists on the request. + * + * @param string $key + * @return bool + */ + public static function has($key) + { + return ! is_null(static::$app['request']->cookie($key, null)); + } + + /** + * Retrieve a cookie from the request. + * + * @param string $key + * @param mixed $default + * @return string + */ + public static function get($key = null, $default = null) + { + return static::$app['request']->cookie($key, $default); + } + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'cookie'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Crypt.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Encryption\Encrypter - */ -class Crypt extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'encrypter'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Encryption\Encrypter + */ +class Crypt extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'encrypter'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/DB.php
@@ -1,16 +1,16 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Database\DatabaseManager - * @see \Illuminate\Database\Connection - */ -class DB extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'db'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Database\DatabaseManager + * @see \Illuminate\Database\Connection + */ +class DB extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'db'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Event.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Events\Dispatcher - */ -class Event extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'events'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Events\Dispatcher + */ +class Event extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'events'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/File.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Filesystem\Filesystem - */ -class File extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'files'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Filesystem\Filesystem + */ +class File extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'files'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Hash.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Hashing\BcryptHasher - */ -class Hash extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'hash'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Hashing\BcryptHasher + */ +class Hash extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'hash'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Input.php
@@ -1,29 +1,29 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Http\Request - */ -class Input extends Facade { - - /** - * Get an item from the input data. - * - * This method is used for all request verbs (GET, POST, PUT, and DELETE) - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public static function get($key = null, $default = null) - { - return static::$app['request']->input($key, $default); - } - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'request'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Http\Request + */ +class Input extends Facade { + + /** + * Get an item from the input data. + * + * This method is used for all request verbs (GET, POST, PUT, and DELETE) + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public static function get($key = null, $default = null) + { + return static::$app['request']->input($key, $default); + } + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'request'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Lang.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Translation\Translator - */ -class Lang extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'translator'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Translation\Translator + */ +class Lang extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'translator'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Log.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Log\Writer - */ -class Log extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'log'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Log\Writer + */ +class Log extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'log'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Mail.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Mail\Mailer - */ -class Mail extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'mailer'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Mail\Mailer + */ +class Mail extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'mailer'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Redirect.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Routing\Redirector - */ -class Redirect extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'redirect'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Routing\Redirector + */ +class Redirect extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'redirect'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Redis.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Redis\Database - */ -class Redis extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'redis'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Redis\Database + */ +class Redis extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'redis'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Request.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Http\Request - */ -class Request extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'request'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Http\Request + */ +class Request extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'request'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Route.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Routing\Router - */ -class Route extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'router'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Routing\Router + */ +class Route extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'router'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Schema.php
@@ -1,29 +1,29 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Database\Schema\Builder - */ -class Schema extends Facade { - - /** - * Get a schema builder instance for a connection. - * - * @param string $name - * @return \Illuminate\Database\Schema\Builder - */ - public static function connection($name) - { - return static::$app['db']->connection($name)->getSchemaBuilder(); - } - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() - { - return static::$app['db']->connection()->getSchemaBuilder(); - } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Database\Schema\Builder + */ +class Schema extends Facade { + + /** + * Get a schema builder instance for a connection. + * + * @param string $name + * @return \Illuminate\Database\Schema\Builder + */ + public static function connection($name) + { + return static::$app['db']->connection($name)->getSchemaBuilder(); + } + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() + { + return static::$app['db']->connection()->getSchemaBuilder(); + } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Session.php
@@ -1,16 +1,16 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Session\SessionManager - * @see \Illuminate\Session\Store - */ -class Session extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'session'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Session\SessionManager + * @see \Illuminate\Session\Store + */ +class Session extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'session'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/URL.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Routing\UrlGenerator - */ -class URL extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'url'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Routing\UrlGenerator + */ +class URL extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'url'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/Validator.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Validation\Factory - */ -class Validator extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'validator'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\Validation\Factory + */ +class Validator extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'validator'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/Support/Facades/View.php
@@ -1,15 +1,15 @@ -<?php namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\View\Factory - */ -class View extends Facade { - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return 'view'; } - -} +<?php namespace Illuminate\Support\Facades; + +/** + * @see \Illuminate\View\Factory + */ +class View extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'view'; } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
src/Illuminate/View/ViewServiceProvider.php
@@ -1,129 +1,129 @@ -<?php namespace Illuminate\View; - -use Illuminate\View\Engines\PhpEngine; -use Illuminate\Support\ServiceProvider; -use Illuminate\View\Engines\CompilerEngine; -use Illuminate\View\Engines\EngineResolver; -use Illuminate\View\Compilers\BladeCompiler; - -class ViewServiceProvider extends ServiceProvider { - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->registerEngineResolver(); - - $this->registerViewFinder(); - - $this->registerFactory(); - } - - /** - * Register the engine resolver instance. - * - * @return void - */ - public function registerEngineResolver() - { - $this->app->singleton('view.engine.resolver', function() - { - $resolver = new EngineResolver; - - // Next we will register the various engines with the resolver so that the - // environment can resolve the engines it needs for various views based - // on the extension of view files. We call a method for each engines. - foreach (array('php', 'blade') as $engine) - { - $this->{'register'.ucfirst($engine).'Engine'}($resolver); - } - - return $resolver; - }); - } - - /** - * Register the PHP engine implementation. - * - * @param \Illuminate\View\Engines\EngineResolver $resolver - * @return void - */ - public function registerPhpEngine($resolver) - { - $resolver->register('php', function() { return new PhpEngine; }); - } - - /** - * Register the Blade engine implementation. - * - * @param \Illuminate\View\Engines\EngineResolver $resolver - * @return void - */ - public function registerBladeEngine($resolver) - { - $app = $this->app; - - // The Compiler engine requires an instance of the CompilerInterface, which in - // this case will be the Blade compiler, so we'll first create the compiler - // instance to pass into the engine so it can compile the views properly. - $app->singleton('blade.compiler', function($app) - { - $cache = $app['config']['view.compiled']; - - return new BladeCompiler($app['files'], $cache); - }); - - $resolver->register('blade', function() use ($app) - { - return new CompilerEngine($app['blade.compiler'], $app['files']); - }); - } - - /** - * Register the view finder implementation. - * - * @return void - */ - public function registerViewFinder() - { - $this->app->bind('view.finder', function($app) - { - $paths = $app['config']['view.paths']; - - return new FileViewFinder($app['files'], $paths); - }); - } - - /** - * Register the view environment. - * - * @return void - */ - public function registerFactory() - { - $this->app->singleton('view', function($app) - { - // Next we need to grab the engine resolver instance that will be used by the - // environment. The resolver will be used by an environment to get each of - // the various engine implementations such as plain PHP or Blade engine. - $resolver = $app['view.engine.resolver']; - - $finder = $app['view.finder']; - - $env = new Factory($resolver, $finder, $app['events']); - - // We will also set the container instance on this view environment since the - // view composers may be classes registered in the container, which allows - // for great testable, flexible composers for the application developer. - $env->setContainer($app); - - $env->share('app', $app); - - return $env; - }); - } - -} +<?php namespace Illuminate\View; + +use Illuminate\View\Engines\PhpEngine; +use Illuminate\Support\ServiceProvider; +use Illuminate\View\Engines\CompilerEngine; +use Illuminate\View\Engines\EngineResolver; +use Illuminate\View\Compilers\BladeCompiler; + +class ViewServiceProvider extends ServiceProvider { + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerEngineResolver(); + + $this->registerViewFinder(); + + $this->registerFactory(); + } + + /** + * Register the engine resolver instance. + * + * @return void + */ + public function registerEngineResolver() + { + $this->app->singleton('view.engine.resolver', function() + { + $resolver = new EngineResolver; + + // Next we will register the various engines with the resolver so that the + // environment can resolve the engines it needs for various views based + // on the extension of view files. We call a method for each engines. + foreach (array('php', 'blade') as $engine) + { + $this->{'register'.ucfirst($engine).'Engine'}($resolver); + } + + return $resolver; + }); + } + + /** + * Register the PHP engine implementation. + * + * @param \Illuminate\View\Engines\EngineResolver $resolver + * @return void + */ + public function registerPhpEngine($resolver) + { + $resolver->register('php', function() { return new PhpEngine; }); + } + + /** + * Register the Blade engine implementation. + * + * @param \Illuminate\View\Engines\EngineResolver $resolver + * @return void + */ + public function registerBladeEngine($resolver) + { + $app = $this->app; + + // The Compiler engine requires an instance of the CompilerInterface, which in + // this case will be the Blade compiler, so we'll first create the compiler + // instance to pass into the engine so it can compile the views properly. + $app->singleton('blade.compiler', function($app) + { + $cache = $app['config']['view.compiled']; + + return new BladeCompiler($app['files'], $cache); + }); + + $resolver->register('blade', function() use ($app) + { + return new CompilerEngine($app['blade.compiler'], $app['files']); + }); + } + + /** + * Register the view finder implementation. + * + * @return void + */ + public function registerViewFinder() + { + $this->app->bind('view.finder', function($app) + { + $paths = $app['config']['view.paths']; + + return new FileViewFinder($app['files'], $paths); + }); + } + + /** + * Register the view environment. + * + * @return void + */ + public function registerFactory() + { + $this->app->singleton('view', function($app) + { + // Next we need to grab the engine resolver instance that will be used by the + // environment. The resolver will be used by an environment to get each of + // the various engine implementations such as plain PHP or Blade engine. + $resolver = $app['view.engine.resolver']; + + $finder = $app['view.finder']; + + $env = new Factory($resolver, $finder, $app['events']); + + // We will also set the container instance on this view environment since the + // view composers may be classes registered in the container, which allows + // for great testable, flexible composers for the application developer. + $env->setContainer($app); + + $env->share('app', $app); + + return $env; + }); + } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
tests/Queue/QueueListenerTest.php
@@ -1,47 +1,47 @@ -<?php - -use Mockery as m; - -class QueueListenerTest extends PHPUnit_Framework_TestCase { - - public function tearDown() - { - m::close(); - } - - - public function testRunProcessCallsProcess() - { - $process = m::mock('Symfony\Component\Process\Process')->makePartial(); - $process->shouldReceive('run')->once(); - $listener = m::mock('Illuminate\Queue\Listener')->makePartial(); - $listener->shouldReceive('memoryExceeded')->once()->with(1)->andReturn(false); - - $listener->runProcess($process, 1); - } - - - public function testListenerStopsWhenMemoryIsExceeded() - { - $process = m::mock('Symfony\Component\Process\Process')->makePartial(); - $process->shouldReceive('run')->once(); - $listener = m::mock('Illuminate\Queue\Listener')->makePartial(); - $listener->shouldReceive('memoryExceeded')->once()->with(1)->andReturn(true); - $listener->shouldReceive('stop')->once(); - - $listener->runProcess($process, 1); - } - - - public function testMakeProcessCorrectlyFormatsCommandLine() - { - $listener = new Illuminate\Queue\Listener(__DIR__); - $process = $listener->makeProcess('connection', 'queue', 1, 2, 3); - - $this->assertInstanceOf('Symfony\Component\Process\Process', $process); - $this->assertEquals(__DIR__, $process->getWorkingDirectory()); - $this->assertEquals(3, $process->getTimeout()); - $this->assertEquals('"'.PHP_BINARY.'" artisan queue:work connection --queue="queue" --delay=1 --memory=2 --sleep=3 --tries=0', $process->getCommandLine()); - } - -} +<?php + +use Mockery as m; + +class QueueListenerTest extends PHPUnit_Framework_TestCase { + + public function tearDown() + { + m::close(); + } + + + public function testRunProcessCallsProcess() + { + $process = m::mock('Symfony\Component\Process\Process')->makePartial(); + $process->shouldReceive('run')->once(); + $listener = m::mock('Illuminate\Queue\Listener')->makePartial(); + $listener->shouldReceive('memoryExceeded')->once()->with(1)->andReturn(false); + + $listener->runProcess($process, 1); + } + + + public function testListenerStopsWhenMemoryIsExceeded() + { + $process = m::mock('Symfony\Component\Process\Process')->makePartial(); + $process->shouldReceive('run')->once(); + $listener = m::mock('Illuminate\Queue\Listener')->makePartial(); + $listener->shouldReceive('memoryExceeded')->once()->with(1)->andReturn(true); + $listener->shouldReceive('stop')->once(); + + $listener->runProcess($process, 1); + } + + + public function testMakeProcessCorrectlyFormatsCommandLine() + { + $listener = new Illuminate\Queue\Listener(__DIR__); + $process = $listener->makeProcess('connection', 'queue', 1, 2, 3); + + $this->assertInstanceOf('Symfony\Component\Process\Process', $process); + $this->assertEquals(__DIR__, $process->getWorkingDirectory()); + $this->assertEquals(3, $process->getTimeout()); + $this->assertEquals('"'.PHP_BINARY.'" artisan queue:work connection --queue="queue" --delay=1 --memory=2 --sleep=3 --tries=0', $process->getCommandLine()); + } + +}
true
Other
laravel
framework
ec0df100c5b97aeeb5e478e65ba5e5689365dd93.json
Normalize all the line endings
tests/Support/SupportMessageBagTest.php
@@ -1,165 +1,165 @@ -<?php - -use Illuminate\Support\MessageBag; -use Mockery as m; - -class SupportMessageBagTest extends PHPUnit_Framework_TestCase { - - public function tearDown() - { - m::close(); - } - - - public function testUniqueness() - { - $container = new MessageBag; - $container->add('foo', 'bar'); - $container->add('foo', 'bar'); - $messages = $container->getMessages(); - $this->assertEquals(array('bar'), $messages['foo']); - } - - - public function testMessagesAreAdded() - { - $container = new MessageBag; - $container->setFormat(':message'); - $container->add('foo', 'bar'); - $container->add('foo', 'baz'); - $container->add('boom', 'bust'); - $messages = $container->getMessages(); - $this->assertEquals(array('bar', 'baz'), $messages['foo']); - $this->assertEquals(array('bust'), $messages['boom']); - } - - - public function testMessagesMayBeMerged() - { - $container = new MessageBag(array('username' => array('foo'))); - $container->merge(array('username' => array('bar'))); - $this->assertEquals(array('username' => array('foo', 'bar')), $container->getMessages()); - } - - - public function testMessageBagsCanBeMerged() - { - $container = new MessageBag(array('foo' => array('bar'))); - $otherContainer = new MessageBag(array('foo' => array('baz'), 'bar' => array('foo'))); - $container->merge($otherContainer); - $this->assertEquals(array('foo' => array('bar', 'baz'), 'bar' => array('foo')), $container->getMessages()); - } - - - public function testGetReturnsArrayOfMessagesByKey() - { - $container = new MessageBag; - $container->setFormat(':message'); - $container->add('foo', 'bar'); - $container->add('foo', 'baz'); - $this->assertEquals(array('bar', 'baz'), $container->get('foo')); - } - - - public function testFirstReturnsSingleMessage() - { - $container = new MessageBag; - $container->setFormat(':message'); - $container->add('foo', 'bar'); - $container->add('foo', 'baz'); - $messages = $container->getMessages(); - $this->assertEquals('bar', $container->first('foo')); - } - - - public function testHasIndicatesExistence() - { - $container = new MessageBag; - $container->setFormat(':message'); - $container->add('foo', 'bar'); - $this->assertTrue($container->has('foo')); - $this->assertFalse($container->has('bar')); - } - - - public function testAllReturnsAllMessages() - { - $container = new MessageBag; - $container->setFormat(':message'); - $container->add('foo', 'bar'); - $container->add('boom', 'baz'); - $this->assertEquals(array('bar', 'baz'), $container->all()); - } - - - public function testFormatIsRespected() - { - $container = new MessageBag; - $container->setFormat('<p>:message</p>'); - $container->add('foo', 'bar'); - $container->add('boom', 'baz'); - $this->assertEquals('<p>bar</p>', $container->first('foo')); - $this->assertEquals(array('<p>bar</p>'), $container->get('foo')); - $this->assertEquals(array('<p>bar</p>', '<p>baz</p>'), $container->all()); - $this->assertEquals('bar', $container->first('foo', ':message')); - $this->assertEquals(array('bar'), $container->get('foo', ':message')); - $this->assertEquals(array('bar', 'baz'), $container->all(':message')); - - $container->setFormat(':key :message'); - $this->assertEquals('foo bar', $container->first('foo')); - } - - - public function testMessageBagReturnsCorrectArray() - { - $container = new MessageBag; - $container->setFormat(':message'); - $container->add('foo', 'bar'); - $container->add('boom', 'baz'); - - $this->assertEquals(array('foo' => array('bar'), 'boom' => array('baz')), $container->toArray()); - } - - - public function testMessageBagReturnsExpectedJson() - { - $container = new MessageBag; - $container->setFormat(':message'); - $container->add('foo', 'bar'); - $container->add('boom', 'baz'); - - $this->assertEquals('{"foo":["bar"],"boom":["baz"]}', $container->toJson()); - } - - - public function testCountReturnsCorrectValue() - { - $container = new MessageBag; - $this->assertEquals(0, $container->count()); - - $container->add('foo', 'bar'); - $container->add('foo', 'baz'); - $container->add('boom', 'baz'); - - $this->assertEquals(3, $container->count()); - } - - - public function testCountable() - { - $container = new MessageBag; - - $container->add('foo', 'bar'); - $container->add('boom', 'baz'); - - $this->assertCount(2, $container); - } - - - public function testConstructor() - { - $messageBag = new MessageBag(array('country' => 'Azerbaijan', 'capital' => 'Baku')); - $this->assertEquals(array('country' => array('Azerbaijan'), 'capital' => array('Baku')), $messageBag->getMessages()); - } - -} +<?php + +use Illuminate\Support\MessageBag; +use Mockery as m; + +class SupportMessageBagTest extends PHPUnit_Framework_TestCase { + + public function tearDown() + { + m::close(); + } + + + public function testUniqueness() + { + $container = new MessageBag; + $container->add('foo', 'bar'); + $container->add('foo', 'bar'); + $messages = $container->getMessages(); + $this->assertEquals(array('bar'), $messages['foo']); + } + + + public function testMessagesAreAdded() + { + $container = new MessageBag; + $container->setFormat(':message'); + $container->add('foo', 'bar'); + $container->add('foo', 'baz'); + $container->add('boom', 'bust'); + $messages = $container->getMessages(); + $this->assertEquals(array('bar', 'baz'), $messages['foo']); + $this->assertEquals(array('bust'), $messages['boom']); + } + + + public function testMessagesMayBeMerged() + { + $container = new MessageBag(array('username' => array('foo'))); + $container->merge(array('username' => array('bar'))); + $this->assertEquals(array('username' => array('foo', 'bar')), $container->getMessages()); + } + + + public function testMessageBagsCanBeMerged() + { + $container = new MessageBag(array('foo' => array('bar'))); + $otherContainer = new MessageBag(array('foo' => array('baz'), 'bar' => array('foo'))); + $container->merge($otherContainer); + $this->assertEquals(array('foo' => array('bar', 'baz'), 'bar' => array('foo')), $container->getMessages()); + } + + + public function testGetReturnsArrayOfMessagesByKey() + { + $container = new MessageBag; + $container->setFormat(':message'); + $container->add('foo', 'bar'); + $container->add('foo', 'baz'); + $this->assertEquals(array('bar', 'baz'), $container->get('foo')); + } + + + public function testFirstReturnsSingleMessage() + { + $container = new MessageBag; + $container->setFormat(':message'); + $container->add('foo', 'bar'); + $container->add('foo', 'baz'); + $messages = $container->getMessages(); + $this->assertEquals('bar', $container->first('foo')); + } + + + public function testHasIndicatesExistence() + { + $container = new MessageBag; + $container->setFormat(':message'); + $container->add('foo', 'bar'); + $this->assertTrue($container->has('foo')); + $this->assertFalse($container->has('bar')); + } + + + public function testAllReturnsAllMessages() + { + $container = new MessageBag; + $container->setFormat(':message'); + $container->add('foo', 'bar'); + $container->add('boom', 'baz'); + $this->assertEquals(array('bar', 'baz'), $container->all()); + } + + + public function testFormatIsRespected() + { + $container = new MessageBag; + $container->setFormat('<p>:message</p>'); + $container->add('foo', 'bar'); + $container->add('boom', 'baz'); + $this->assertEquals('<p>bar</p>', $container->first('foo')); + $this->assertEquals(array('<p>bar</p>'), $container->get('foo')); + $this->assertEquals(array('<p>bar</p>', '<p>baz</p>'), $container->all()); + $this->assertEquals('bar', $container->first('foo', ':message')); + $this->assertEquals(array('bar'), $container->get('foo', ':message')); + $this->assertEquals(array('bar', 'baz'), $container->all(':message')); + + $container->setFormat(':key :message'); + $this->assertEquals('foo bar', $container->first('foo')); + } + + + public function testMessageBagReturnsCorrectArray() + { + $container = new MessageBag; + $container->setFormat(':message'); + $container->add('foo', 'bar'); + $container->add('boom', 'baz'); + + $this->assertEquals(array('foo' => array('bar'), 'boom' => array('baz')), $container->toArray()); + } + + + public function testMessageBagReturnsExpectedJson() + { + $container = new MessageBag; + $container->setFormat(':message'); + $container->add('foo', 'bar'); + $container->add('boom', 'baz'); + + $this->assertEquals('{"foo":["bar"],"boom":["baz"]}', $container->toJson()); + } + + + public function testCountReturnsCorrectValue() + { + $container = new MessageBag; + $this->assertEquals(0, $container->count()); + + $container->add('foo', 'bar'); + $container->add('foo', 'baz'); + $container->add('boom', 'baz'); + + $this->assertEquals(3, $container->count()); + } + + + public function testCountable() + { + $container = new MessageBag; + + $container->add('foo', 'bar'); + $container->add('boom', 'baz'); + + $this->assertCount(2, $container); + } + + + public function testConstructor() + { + $messageBag = new MessageBag(array('country' => 'Azerbaijan', 'capital' => 'Baku')); + $this->assertEquals(array('country' => array('Azerbaijan'), 'capital' => array('Baku')), $messageBag->getMessages()); + } + +}
true
Other
laravel
framework
4d2764e9bf1e0fbe05da66d2701db493af870390.json
Ask git to use unix style newlines
.gitattributes
@@ -1,3 +1,5 @@ +* text=auto + /build export-ignore /tests export-ignore .gitattributes export-ignore
false
Other
laravel
framework
6670a242a822676fbf995e6d494c4720acc810ae.json
Use FETCH_OBJ instead of FETCH_CLASS.
src/Illuminate/Database/Capsule/Manager.php
@@ -44,7 +44,7 @@ public function __construct(Container $container = null) */ protected function setupDefaultConfiguration() { - $this->container['config']['database.fetch'] = PDO::FETCH_CLASS; + $this->container['config']['database.fetch'] = PDO::FETCH_OBJ; $this->container['config']['database.default'] = 'default'; }
true
Other
laravel
framework
6670a242a822676fbf995e6d494c4720acc810ae.json
Use FETCH_OBJ instead of FETCH_CLASS.
src/Illuminate/Database/Connection.php
@@ -66,7 +66,7 @@ class Connection implements ConnectionInterface { * * @var int */ - protected $fetchMode = PDO::FETCH_CLASS; + protected $fetchMode = PDO::FETCH_OBJ; /** * The number of active transactions.
true
Other
laravel
framework
419d3f485ce7946cace4325ef19a30e1d5543951.json
allow forcing of stroage directory for opts
src/Illuminate/Foundation/Application.php
@@ -20,7 +20,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn * * @var string */ - const VERSION = '5.0.19'; + const VERSION = '5.0.20'; /** * The base path for the Laravel installation. @@ -92,6 +92,13 @@ class Application extends Container implements ApplicationContract, HttpKernelIn */ protected $storagePath; + /** + * Indicates if the storage directory should be used for optimizations. + * + * @var bool + */ + protected $useStoragePathForOptimizations = false; + /** * The environment file to load during bootstrapping. * @@ -722,7 +729,7 @@ public function configurationIsCached() */ public function getCachedConfigPath() { - if ($this->vendorIsWritable()) + if ($this->vendorIsWritableForOptimizations()) { return $this->basePath().'/vendor/config.php'; } @@ -749,7 +756,7 @@ public function routesAreCached() */ public function getCachedRoutesPath() { - if ($this->vendorIsWritable()) + if ($this->vendorIsWritableForOptimizations()) { return $this->basePath().'/vendor/routes.php'; } @@ -766,7 +773,7 @@ public function getCachedRoutesPath() */ public function getCachedCompilePath() { - if ($this->vendorIsWritable()) + if ($this->vendorIsWritableForOptimizations()) { return $this->basePath().'/vendor/compiled.php'; } @@ -783,7 +790,7 @@ public function getCachedCompilePath() */ public function getCachedServicesPath() { - if ($this->vendorIsWritable()) + if ($this->vendorIsWritableForOptimizations()) { return $this->basePath().'/vendor/services.json'; } @@ -798,11 +805,26 @@ public function getCachedServicesPath() * * @return bool */ - public function vendorIsWritable() + public function vendorIsWritableForOptimizations() { + if ($this->useStoragePathForOptimizations) return false; + return is_writable($this->basePath().'/vendor'); } + /** + * Determines if storage directory should be used for optimizations. + * + * @param bool $value + * @return $this + */ + public function useStoragePathForOptimizations($value = true) + { + $this->useStoragePathForOptimizations = $value; + + return $this; + } + /** * Call the booting callbacks for the application. *
false
Other
laravel
framework
08f27292942aadabeb577557a16832305e4a655a.json
Use LONGTEXT instead of TEXT
src/Illuminate/Queue/Console/stubs/failed_jobs.stub
@@ -16,7 +16,7 @@ class CreateFailedJobsTable extends Migration $table->increments('id'); $table->text('connection'); $table->text('queue'); - $table->text('payload'); + $table->longText('payload'); $table->timestamp('failed_at'); }); }
false
Other
laravel
framework
cfba00f2dee92bbba9343004d3d1e8aa0a3e269e.json
Make migration opt-in with shortcut.
src/Illuminate/Foundation/Console/ModelMakeCommand.php
@@ -35,7 +35,7 @@ public function fire() { parent::fire(); - if ( ! $this->option('no-migration')) + if ($this->option('migration')) { $table = str_plural(snake_case(class_basename($this->argument('name')))); @@ -72,7 +72,7 @@ protected function getDefaultNamespace($rootNamespace) protected function getOptions() { return array( - array('no-migration', null, InputOption::VALUE_NONE, 'Do not create a new migration file.'), + array('migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model.'), ); }
false
Other
laravel
framework
033801f0ba200a4f7c5e8bb54cbd6c7524e91038.json
Simplify app helper. Remove recursive call.
src/Illuminate/Foundation/helpers.php
@@ -1,6 +1,7 @@ <?php use Illuminate\Support\Str; +use Illuminate\Container\Container; if ( ! function_exists('abort')) { @@ -45,14 +46,11 @@ function action($name, $parameters = array()) * @param array $parameters * @return mixed|\Illuminate\Foundation\Application */ - function app($make = null, $parameters = array()) + function app($make = null, $parameters = []) { - if ( ! is_null($make)) - { - return app()->make($make, $parameters); - } + if (is_null($make)) return Container::getInstance(); - return Illuminate\Container\Container::getInstance(); + return Container::getInstance()->make($make, $parameters); } } @@ -600,7 +598,7 @@ function env($key, $default = null) case '(empty)': return ''; } - + if (Str::startsWith($value, '"') && Str::endsWith($value, '"')) { return substr($value, 1, -1);
false
Other
laravel
framework
b7c4b1c1acf973b2cc50f1a7c2a7190d91623a06.json
Use useAsCallable instead of is_callable
src/Illuminate/Support/Collection.php
@@ -89,7 +89,7 @@ public function contains($key, $value = null) }); } - if (is_callable($key)) + if ($this->useAsCallable($key)) { return ! is_null($this->first($key)); }
false
Other
laravel
framework
3dbb9588885b93ffde1f65015ff74a057d11329b.json
Add parameters to app() function
src/Illuminate/Foundation/helpers.php
@@ -42,13 +42,14 @@ function action($name, $parameters = array()) * Get the available container instance. * * @param string $make - * @return mixed + * @param array $parameters + * @return mixed|\Illuminate\Foundation\Application */ - function app($make = null) + function app($make = null, $parameters = array()) { if ( ! is_null($make)) { - return app()->make($make); + return app()->make($make, $parameters); } return Illuminate\Container\Container::getInstance();
false
Other
laravel
framework
e22171a44126d458d6e7f89a5ae38fbf15ae321c.json
Add collection to $casts Add support for collection to $casts
src/Illuminate/Database/Eloquent/Model.php
@@ -2739,6 +2739,8 @@ protected function castAttribute($key, $value) case 'array': case 'json': return json_decode($value, true); + case 'collection': + return new Collection(json_decode($value, true)); default: return $value; }
false
Other
laravel
framework
31cfc3b924b7d67cb7869ed566e39d15133770e7.json
Add test for translator replacements back.
tests/Translation/TranslationTranslatorTest.php
@@ -36,6 +36,7 @@ public function testGetMethodProperlyLoadsAndRetrievesItemWithLongestReplacement { $t = $this->getMock('Illuminate\Translation\Translator', null, array($this->getLoader(), 'en')); $t->getLoader()->shouldReceive('load')->once()->with('en', 'bar', 'foo')->andReturn(array('foo' => 'foo', 'baz' => 'breeze :foo :foobar')); + $this->assertEquals('breeze bar taylor', $t->get('foo::bar.baz', array('foo' => 'bar', 'foobar' => 'taylor'), 'en')); $this->assertEquals('breeze foo bar baz taylor', $t->get('foo::bar.baz', array('foo' => 'foo bar baz', 'foobar' => 'taylor'), 'en')); $this->assertEquals('foo', $t->get('foo::bar.foo')); }
false
Other
laravel
framework
b7fa52c6abb076e6844798f793231bc2886aa0d5.json
Simplify the find method
src/Illuminate/Database/Eloquent/Builder.php
@@ -70,7 +70,7 @@ public function __construct(QueryBuilder $query) * * @param mixed $id * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|static|null + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null */ public function find($id, $columns = array('*')) { @@ -87,15 +87,15 @@ public function find($id, $columns = array('*')) /** * Find a model by its primary key. * - * @param array $id + * @param array $ids * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|Collection|static + * @return \Illuminate\Database\Eloquent\Collection */ - public function findMany($id, $columns = array('*')) + public function findMany($ids, $columns = array('*')) { - if (empty($id)) return $this->model->newCollection(); + if (empty($ids)) return $this->model->newCollection(); - $this->query->whereIn($this->model->getQualifiedKeyName(), $id); + $this->query->whereIn($this->model->getQualifiedKeyName(), $ids); return $this->get($columns); }
true
Other
laravel
framework
b7fa52c6abb076e6844798f793231bc2886aa0d5.json
Simplify the find method
src/Illuminate/Database/Eloquent/Model.php
@@ -684,11 +684,7 @@ public static function all($columns = array('*')) */ public static function find($id, $columns = array('*')) { - $instance = new static; - - if (is_array($id) && empty($id)) return $instance->newCollection(); - - return $instance->newQuery()->find($id, $columns); + return static::query()->find($id, $columns); } /**
true
Other
laravel
framework
b7fa52c6abb076e6844798f793231bc2886aa0d5.json
Simplify the find method
tests/Database/DatabaseEloquentIntegrationTest.php
@@ -87,9 +87,30 @@ public function tearDown() public function testBasicModelRetrieval() { - EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']); + EloquentTestUser::create(['id' => 1, 'email' => 'taylorotwell@gmail.com']); + EloquentTestUser::create(['id' => 2, 'email' => 'abigailotwell@gmail.com']); + $model = EloquentTestUser::where('email', 'taylorotwell@gmail.com')->first(); $this->assertEquals('taylorotwell@gmail.com', $model->email); + + $model = EloquentTestUser::find(1); + $this->assertInstanceOf('EloquentTestUser', $model); + $this->assertEquals(1, $model->id); + + $model = EloquentTestUser::find(2); + $this->assertInstanceOf('EloquentTestUser', $model); + $this->assertEquals(2, $model->id); + + $void = EloquentTestUser::find(3); + $this->assertNull($void); + + $collection = EloquentTestUser::find([]); + $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $collection); + $this->assertEquals(0, $collection->count()); + + $collection = EloquentTestUser::find([1, 2, 3]); + $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $collection); + $this->assertEquals(2, $collection->count()); }
true
Other
laravel
framework
7768a18fb4db21d82172abd875aca08e3d00267e.json
set the controller router on the RouteListCommand. Signed-off-by: Suhayb Wardany <me@suw.me>
src/Illuminate/Foundation/Console/RouteListCommand.php
@@ -4,6 +4,7 @@ use Illuminate\Routing\Route; use Illuminate\Routing\Router; use Illuminate\Console\Command; +use Illuminate\Routing\Controller; use Symfony\Component\Console\Input\InputOption; class RouteListCommand extends Command { @@ -152,6 +153,8 @@ protected function getMiddleware($route) */ protected function getControllerMiddleware($actionName) { + Controller::setRouter($this->laravel['router']); + $segments = explode('@', $actionName); return $this->getControllerMiddlewareFromInstance(
false
Other
laravel
framework
7374ad508917663aee6235f0267f3a58cb7b2790.json
Fix bug in Translator::sortReplacements function.
src/Illuminate/Support/Collection.php
@@ -620,7 +620,7 @@ public function sortBy($callback, $options = SORT_REGULAR, $descending = false) // and grab the corresponding values for the sorted keys from this array. foreach ($this->items as $key => $value) { - $results[$key] = $callback($value); + $results[$key] = $callback($value, $key); } $descending ? arsort($results, $options)
true
Other
laravel
framework
7374ad508917663aee6235f0267f3a58cb7b2790.json
Fix bug in Translator::sortReplacements function.
src/Illuminate/Translation/Translator.php
@@ -145,9 +145,9 @@ protected function makeReplacements($line, array $replace) */ protected function sortReplacements(array $replace) { - return (new Collection($replace))->sortBy(function($r) + return (new Collection($replace))->sortBy(function($value, $key) { - return mb_strlen($r) * -1; + return mb_strlen($key) * -1; }); }
true
Other
laravel
framework
7374ad508917663aee6235f0267f3a58cb7b2790.json
Fix bug in Translator::sortReplacements function.
tests/Translation/TranslationTranslatorTest.php
@@ -36,7 +36,7 @@ public function testGetMethodProperlyLoadsAndRetrievesItemWithLongestReplacement { $t = $this->getMock('Illuminate\Translation\Translator', null, array($this->getLoader(), 'en')); $t->getLoader()->shouldReceive('load')->once()->with('en', 'bar', 'foo')->andReturn(array('foo' => 'foo', 'baz' => 'breeze :foo :foobar')); - $this->assertEquals('breeze bar taylor', $t->get('foo::bar.baz', array('foo' => 'bar', 'foobar' => 'taylor'), 'en')); + $this->assertEquals('breeze foo bar baz taylor', $t->get('foo::bar.baz', array('foo' => 'foo bar baz', 'foobar' => 'taylor'), 'en')); $this->assertEquals('foo', $t->get('foo::bar.foo')); }
true
Other
laravel
framework
a83dcabd2ec37359bd728faa36b9282be478c8f1.json
Add support for predis client options
src/Illuminate/Redis/Database.php
@@ -40,7 +40,9 @@ protected function createAggregateClient(array $servers) { $servers = array_except($servers, array('cluster')); - return array('default' => new Client(array_values($servers))); + $options = $this->getClientOptions($servers); + + return array('default' => new Client(array_values($servers), $options)); } /** @@ -53,14 +55,34 @@ protected function createSingleClients(array $servers) { $clients = array(); + $options = $this->getClientOptions($servers); + foreach ($servers as $key => $server) { - $clients[$key] = new Client($server); + $clients[$key] = new Client($server, $options); } return $clients; } + /** + * Get any client options from the config array + * + * @param array $servers + * @return array + */ + protected function getClientOptions($servers) + { + $options = array(); + + if (isset($servers['options']) && $servers['options']) + { + $options = $servers['options']; + } + + return $options; + } + /** * Get a specific Redis connection instance. *
false
Other
laravel
framework
454a73e455c4d7e21532c874b454ab27a0456ba6.json
escape url in pagination bootstrap presenter @ 5.0
src/Illuminate/Pagination/BootstrapThreePresenter.php
@@ -76,7 +76,7 @@ protected function getAvailablePageWrapper($url, $page, $rel = null) { $rel = is_null($rel) ? '' : ' rel="'.$rel.'"'; - return '<li><a href="'.$url.'"'.$rel.'>'.$page.'</a></li>'; + return '<li><a href="'.urlencode($url).'"'.$rel.'>'.$page.'</a></li>'; } /**
false
Other
laravel
framework
cbe3b38bd9e7bd2935691eacccbd1df249ecb1c1.json
Add setValidators method.
src/Illuminate/Routing/Route.php
@@ -636,6 +636,19 @@ public static function getValidators() ); } + /** + * Set the route validators. + * + * @param array $validators + * + * @return void + */ + public static function setValidators($validators) + { + // set validators to match the route. + static::$validators = $validators; + } + /** * Add before filters to the route. *
false
Other
laravel
framework
fdef01ac600d3f8aa83a2537ce95ccb165a98c8d.json
Use collection to remove soft delete scope
src/Illuminate/Database/Eloquent/SoftDeletingScope.php
@@ -36,18 +36,10 @@ public function remove(Builder $builder, Model $model) $query = $builder->getQuery(); - foreach ((array) $query->wheres as $key => $where) + $query->wheres = collect($query->wheres)->reject(function($where) use ($column) { - // If the where clause is a soft delete date constraint, we will remove it from - // the query and reset the keys on the wheres. This allows this developer to - // include deleted model in a relationship result set that is lazy loaded. - if ($this->isSoftDeleteConstraint($where, $column)) - { - unset($query->wheres[$key]); - - $query->wheres = array_values($query->wheres); - } - } + return $this->isSoftDeleteConstraint($where, $column); + })->values()->all(); } /**
false
Other
laravel
framework
04c4b03c15123ebc9a1f943ce965a29c87e5fa3d.json
Add curly brackets
src/Illuminate/Cookie/Middleware/EncryptCookies.php
@@ -87,7 +87,9 @@ protected function decryptArray(array $cookie) $decrypted = array(); foreach ($cookie as $key => $value) + { $decrypted[$key] = $this->encrypter->decrypt($value); + } return $decrypted; }
false
Other
laravel
framework
9279cb5dad9f9eb5714133dd19813b8a7b602668.json
Add a slash after port number
src/Illuminate/Foundation/Console/ServeCommand.php
@@ -34,7 +34,7 @@ public function fire() $base = $this->laravel->basePath(); - $this->info("Laravel development server started on http://{$host}:{$port}"); + $this->info("Laravel development server started on http://{$host}:{$port}/"); passthru('"'.PHP_BINARY.'"'." -S {$host}:{$port} \"{$base}\"/server.php"); }
false
Other
laravel
framework
f1c12d64501202d3b5d178bd4b3d28a61997306d.json
Add argument to cache:clear to specify store name.
src/Illuminate/Cache/Console/ClearCommand.php
@@ -2,6 +2,7 @@ use Illuminate\Console\Command; use Illuminate\Cache\CacheManager; +use Symfony\Component\Console\Input\InputArgument; class ClearCommand extends Command { @@ -46,13 +47,27 @@ public function __construct(CacheManager $cache) */ public function fire() { - $this->laravel['events']->fire('cache:clearing'); + $storeName = $this->argument('store'); - $this->cache->flush(); + $this->laravel['events']->fire('cache:clearing', [$storeName]); - $this->laravel['events']->fire('cache:cleared'); + $this->cache->store($storeName)->flush(); + + $this->laravel['events']->fire('cache:cleared', [$storeName]); $this->info('Application cache cleared!'); } + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['store', InputArgument::OPTIONAL, 'The name of the store you would like to clear.'], + ]; + } + }
true
Other
laravel
framework
f1c12d64501202d3b5d178bd4b3d28a61997306d.json
Add argument to cache:clear to specify store name.
tests/Cache/ClearCommandTest.php
@@ -0,0 +1,84 @@ +<?php + +use Mockery as m; +use Illuminate\Foundation\Application; +use Illuminate\Cache\Console\ClearCommand; + +class ClearCommandTest extends PHPUnit_Framework_TestCase { + + public function tearDown() + { + m::close(); + } + + + public function testClearWithNoStoreOption() + { + $command = new ClearCommandTestStub( + $cacheManager = m::mock('Illuminate\Cache\CacheManager') + ); + + $cacheRepository = m::mock('\Illuminate\Contracts\Cache\Repository'); + + $app = new Application(); + $command->setLaravel($app); + + $cacheManager->shouldReceive('store')->once()->with(null)->andReturn($cacheRepository); + $cacheRepository->shouldReceive('flush')->once(); + + $this->runCommand($command); + } + + + public function testClearWithStoreOption() + { + $command = new ClearCommandTestStub( + $cacheManager = m::mock('Illuminate\Cache\CacheManager') + ); + + $cacheRepository = m::mock('\Illuminate\Contracts\Cache\Repository'); + + $app = new Application(); + $command->setLaravel($app); + + $cacheManager->shouldReceive('store')->once()->with('foo')->andReturn($cacheRepository); + $cacheRepository->shouldReceive('flush')->once(); + + $this->runCommand($command, ['store' => 'foo']); + } + + + public function testClearWithInvalidStoreOption() + { + $command = new ClearCommandTestStub( + $cacheManager = m::mock('Illuminate\Cache\CacheManager') + ); + + $cacheRepository = m::mock('\Illuminate\Contracts\Cache\Repository'); + + $app = new Application(); + $command->setLaravel($app); + + $cacheManager->shouldReceive('store')->once()->with('bar')->andThrow('\InvalidArgumentException'); + $cacheRepository->shouldReceive('flush')->never(); + $this->setExpectedException('InvalidArgumentException'); + + $this->runCommand($command, ['store' => 'bar']); + } + + + protected function runCommand($command, $input = array()) + { + return $command->run(new Symfony\Component\Console\Input\ArrayInput($input), new Symfony\Component\Console\Output\NullOutput); + } + +} + +class ClearCommandTestStub extends ClearCommand { + + public function call($command, array $arguments = array()) + { + // + } + +}
true
Other
laravel
framework
cfa7fcb60fd60b3870606c910559e67186a7a8a8.json
Move the location of some storage files.
src/Illuminate/Foundation/Application.php
@@ -433,7 +433,7 @@ public function runningUnitTests() */ public function registerConfiguredProviders() { - $manifestPath = $this->storagePath().DIRECTORY_SEPARATOR.'framework'.DIRECTORY_SEPARATOR.'services.json'; + $manifestPath = $this->basePath().'/vendor/services.json'; (new ProviderRepository($this, new Filesystem, $manifestPath)) ->load($this->config['app.providers']); @@ -742,7 +742,7 @@ public function routesAreCached() */ public function getCachedRoutesPath() { - return $this['path.storage'].DIRECTORY_SEPARATOR.'framework'.DIRECTORY_SEPARATOR.'routes.php'; + return $this->basePath().'/vendor/routes.php'; } /**
true
Other
laravel
framework
cfa7fcb60fd60b3870606c910559e67186a7a8a8.json
Move the location of some storage files.
src/Illuminate/Foundation/Console/ClearCompiledCommand.php
@@ -25,12 +25,12 @@ class ClearCompiledCommand extends Command { */ public function fire() { - if (file_exists($path = $this->laravel->storagePath().'/framework/compiled.php')) + if (file_exists($path = $this->laravel->basePath().'/vendor/compiled.php')) { @unlink($path); } - if (file_exists($path = $this->laravel->storagePath().'/framework/services.json')) + if (file_exists($path = $this->laravel->basePath().'/vendor/services.json')) { @unlink($path); }
true
Other
laravel
framework
cfa7fcb60fd60b3870606c910559e67186a7a8a8.json
Move the location of some storage files.
src/Illuminate/Foundation/Console/OptimizeCommand.php
@@ -86,7 +86,7 @@ protected function compileClasses() { $this->registerClassPreloaderCommand(); - $outputPath = $this->laravel['path.storage'].'/framework/compiled.php'; + $outputPath = $this->laravel['path.base'].'/vendor/compiled.php'; $this->callSilent('compile', array( '--config' => implode(',', $this->getClassFiles()),
true
Other
laravel
framework
27b1d17a420b4556a261c6f7a49115a90edd1018.json
Add type hinting on $parameters
src/Illuminate/Container/Container.php
@@ -543,7 +543,7 @@ protected function isCallableWithAtSign($callback) * @param array $parameters * @return array */ - protected function getMethodDependencies($callback, $parameters = []) + protected function getMethodDependencies($callback, array $parameters = []) { $dependencies = []; @@ -634,7 +634,7 @@ protected function callClass($target, array $parameters = [], $defaultMethod = n * @param array $parameters * @return mixed */ - public function make($abstract, $parameters = []) + public function make($abstract, array $parameters = []) { $abstract = $this->getAlias($abstract); @@ -763,7 +763,7 @@ protected function getExtenders($abstract) * * @throws BindingResolutionException */ - public function build($concrete, $parameters = []) + public function build($concrete, array $parameters = []) { // If the concrete type is actually a Closure, we will just execute it and // hand back the results of the functions, which allows functions to be @@ -824,7 +824,7 @@ public function build($concrete, $parameters = []) * @param array $primitives * @return array */ - protected function getDependencies($parameters, array $primitives = []) + protected function getDependencies(array $parameters, array $primitives = []) { $dependencies = [];
true
Other
laravel
framework
27b1d17a420b4556a261c6f7a49115a90edd1018.json
Add type hinting on $parameters
src/Illuminate/Contracts/Container/Container.php
@@ -102,7 +102,7 @@ public function when($concrete); * @param array $parameters * @return mixed */ - public function make($abstract, $parameters = array()); + public function make($abstract, array $parameters = []); /** * Call the given Closure / class@method and inject its dependencies. @@ -112,7 +112,7 @@ public function make($abstract, $parameters = array()); * @param string|null $defaultMethod * @return mixed */ - public function call($callback, array $parameters = array(), $defaultMethod = null); + public function call($callback, array $parameters = [], $defaultMethod = null); /** * Determine if the given abstract type has been resolved.
true
Other
laravel
framework
27b1d17a420b4556a261c6f7a49115a90edd1018.json
Add type hinting on $parameters
src/Illuminate/Foundation/Application.php
@@ -601,7 +601,7 @@ public function registerDeferredProvider($provider, $service = null) * @param array $parameters * @return mixed */ - public function make($abstract, $parameters = array()) + public function make($abstract, array $parameters = array()) { $abstract = $this->getAlias($abstract);
true
Other
laravel
framework
8f63a4e1e982511592e665cea615111fc5e8aa31.json
Remove unnecessary code
src/Illuminate/Cache/FileStore.php
@@ -57,11 +57,6 @@ protected function getPayload($key) // If the file doesn't exists, we obviously can't return the cache so we will // just return null. Otherwise, we'll get the contents of the file and get // the expiration UNIX timestamps from the start of the file's contents. - if ( ! $this->files->exists($path)) - { - return array('data' => null, 'time' => null); - } - try { $expire = substr($contents = $this->files->get($path), 0, 10);
true
Other
laravel
framework
8f63a4e1e982511592e665cea615111fc5e8aa31.json
Remove unnecessary code
tests/Cache/CacheFileStoreTest.php
@@ -1,13 +1,14 @@ <?php use Illuminate\Cache\FileStore; +use Illuminate\Contracts\Filesystem\FileNotFoundException; class CacheFileStoreTest extends PHPUnit_Framework_TestCase { public function testNullIsReturnedIfFileDoesntExist() { $files = $this->mockFilesystem(); - $files->expects($this->once())->method('exists')->will($this->returnValue(false)); + $files->expects($this->once())->method('get')->will($this->throwException(new FileNotFoundException())); $store = new FileStore($files, __DIR__); $value = $store->get('foo'); $this->assertNull($value); @@ -29,7 +30,6 @@ public function testPutCreatesMissingDirectories() public function testExpiredItemsReturnNull() { $files = $this->mockFilesystem(); - $files->expects($this->once())->method('exists')->will($this->returnValue(true)); $contents = '0000000000'; $files->expects($this->once())->method('get')->will($this->returnValue($contents)); $store = $this->getMock('Illuminate\Cache\FileStore', array('forget'), array($files, __DIR__)); @@ -42,7 +42,6 @@ public function testExpiredItemsReturnNull() public function testValidItemReturnsContents() { $files = $this->mockFilesystem(); - $files->expects($this->once())->method('exists')->will($this->returnValue(true)); $contents = '9999999999'.serialize('Hello World'); $files->expects($this->once())->method('get')->will($this->returnValue($contents)); $store = new FileStore($files, __DIR__);
true
Other
laravel
framework
56ec53b2428c27db8cf1d546da17ae27f80c7ff2.json
Add empty line.
src/Illuminate/Database/Eloquent/Model.php
@@ -2449,6 +2449,7 @@ protected function getArrayableAppends() public function relationsToArray() { $attributes = array(); + $hidden = $this->getHidden(); foreach ($this->getArrayableRelations() as $key => $value)
false
Other
laravel
framework
0951a30303b6580a2bdcce5df78f6fbbb6497c0f.json
Shorten code by using the cron method
src/Illuminate/Console/Scheduling/Event.php
@@ -264,9 +264,7 @@ public function cron($expression) */ public function hourly() { - $this->expression = '0 * * * * *'; - - return $this; + return $this->cron('0 * * * * *'); } /** @@ -276,9 +274,7 @@ public function hourly() */ public function daily() { - $this->expression = '0 0 * * * *'; - - return $this; + return $this->cron('0 0 * * * *'); } /** @@ -313,9 +309,7 @@ public function dailyAt($time) */ public function twiceDaily() { - $this->expression = '0 1,13 * * * *'; - - return $this; + return $this->cron('0 1,13 * * * *'); } /** @@ -405,9 +399,7 @@ public function sundays() */ public function weekly() { - $this->expression = '0 0 * * 0 *'; - - return $this; + return $this->cron('0 0 * * 0 *'); } /** @@ -431,9 +423,7 @@ public function weeklyOn($day, $time = '0:0') */ public function monthly() { - $this->expression = '0 0 1 * * *'; - - return $this; + return $this->cron('0 0 1 * * *'); } /** @@ -443,9 +433,7 @@ public function monthly() */ public function yearly() { - $this->expression = '0 0 1 1 * *'; - - return $this; + return $this->cron('0 0 1 1 * *'); } /** @@ -455,9 +443,7 @@ public function yearly() */ public function everyFiveMinutes() { - $this->expression = '*/5 * * * * *'; - - return $this; + return $this->cron('*/5 * * * * *'); } /** @@ -467,9 +453,7 @@ public function everyFiveMinutes() */ public function everyTenMinutes() { - $this->expression = '*/10 * * * * *'; - - return $this; + return $this->cron('*/10 * * * * *'); } /** @@ -479,9 +463,7 @@ public function everyTenMinutes() */ public function everyThirtyMinutes() { - $this->expression = '0,30 * * * * *'; - - return $this; + return $this->cron('0,30 * * * * *'); } /** @@ -693,9 +675,7 @@ protected function spliceIntoPosition($position, $value) $segments[$position - 1] = $value; - $this->expression = implode(' ', $segments); - - return $this; + return $this->cron(implode(' ', $segments)); } /**
false
Other
laravel
framework
d0d30dd2730c177eb1001c2509b389c4ec22efdc.json
Reduce line length
src/Illuminate/Console/Scheduling/Event.php
@@ -492,9 +492,9 @@ public function everyThirtyMinutes() */ public function days($days) { - $this->spliceIntoPosition(5, implode(',', is_array($days) ? $days : func_get_args())); + $days = is_array($days) ? $days : func_get_args(); - return $this; + return $this->spliceIntoPosition(5, implode(',', $days)); } /**
false
Other
laravel
framework
7667cd511ee7982a7b8bb60234856482c141dfb5.json
Allow define hidden/visible options dynamically.
src/Illuminate/Database/Eloquent/Model.php
@@ -2472,7 +2472,7 @@ public function relationsToArray() foreach ($this->getArrayableRelations() as $key => $value) { - if (in_array($key, $this->hidden)) continue; + if (in_array($key, $this->getHidden())) continue; // If the values implements the Arrayable interface we can just call this // toArray method on the instances which will convert both models and @@ -2530,12 +2530,12 @@ protected function getArrayableRelations() */ protected function getArrayableItems(array $values) { - if (count($this->visible) > 0) + if (count($this->getVisible()) > 0) { - return array_intersect_key($values, array_flip($this->visible)); + return array_intersect_key($values, array_flip($this->getVisible())); } - return array_diff_key($values, array_flip($this->hidden)); + return array_diff_key($values, array_flip($this->getHidden())); } /**
true
Other
laravel
framework
7667cd511ee7982a7b8bb60234856482c141dfb5.json
Allow define hidden/visible options dynamically.
tests/Database/DatabaseEloquentModelTest.php
@@ -686,6 +686,56 @@ public function testToArrayUsesMutators() } + public function testHidden() + { + $model = new EloquentModelStub(['name' => 'foo', 'age' => 'bar', 'id' => 'baz']); + $model->setHidden(['age', 'id']); + $array = $model->toArray(); + $this->assertArrayHasKey('name', $array); + $this->assertArrayNotHasKey('age', $array); + } + + + public function testVisible() + { + $model = new EloquentModelStub(['name' => 'foo', 'age' => 'bar', 'id' => 'baz']); + $model->setVisible(['name', 'id']); + $array = $model->toArray(); + $this->assertArrayHasKey('name', $array); + $this->assertArrayNotHasKey('age', $array); + } + + + public function testHiddenAreIgnoringWhenVisibleExists() + { + $model = new EloquentModelStub(['name' => 'foo', 'age' => 'bar', 'id' => 'baz']); + $model->setVisible(['name', 'id']); + $model->setHidden(['name', 'age']); + $array = $model->toArray(); + $this->assertArrayHasKey('name', $array); + $this->assertArrayHasKey('id', $array); + $this->assertArrayNotHasKey('age', $array); + } + + + public function testDynamicHidden() + { + $model = new EloquentModelDynamicHiddenStub(['name' => 'foo', 'age' => 'bar', 'id' => 'baz']); + $array = $model->toArray(); + $this->assertArrayHasKey('name', $array); + $this->assertArrayNotHasKey('age', $array); + } + + + public function testDynamicVisible() + { + $model = new EloquentModelDynamicVisibleStub(['name' => 'foo', 'age' => 'bar', 'id' => 'baz']); + $array = $model->toArray(); + $this->assertArrayHasKey('name', $array); + $this->assertArrayNotHasKey('age', $array); + } + + public function testFillable() { $model = new EloquentModelStub; @@ -1338,3 +1388,21 @@ public function eighthAttributeValue() return $this->attributes['eighth']; } } + +class EloquentModelDynamicHiddenStub extends Illuminate\Database\Eloquent\Model { + protected $table = 'stub'; + protected $guarded = []; + public function getHidden() + { + return ['age', 'id']; + } +} + +class EloquentModelDynamicVisibleStub extends Illuminate\Database\Eloquent\Model { + protected $table = 'stub'; + protected $guarded = []; + public function getVisible() + { + return ['name', 'id']; + } +}
true
Other
laravel
framework
b7d653e408dd8ef396b2a7552f81460d71db25da.json
Fix getFailedLoginMessage typo
src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php
@@ -84,7 +84,7 @@ public function postLogin(Request $request) return redirect($this->loginPath()) ->withInput($request->only('email', 'remember')) ->withErrors([ - 'email' => $this->getFailedLoginMesssage(), + 'email' => $this->getFailedLoginMessage(), ]); } @@ -93,7 +93,7 @@ public function postLogin(Request $request) * * @return string */ - protected function getFailedLoginMesssage() + protected function getFailedLoginMessage() { return 'These credentials do not match our records.'; }
false
Other
laravel
framework
f9e48b2d59880db3c415a26689c78cc278755973.json
Remove unnecessary line
src/Illuminate/Console/Scheduling/Event.php
@@ -153,8 +153,6 @@ protected function runCommandInForeground(Container $container) */ protected function callAfterCallbacks(Container $container) { - if (empty($this->afterCallbacks)) return; - foreach ($this->afterCallbacks as $callback) { $container->call($callback);
false
Other
laravel
framework
e1ec42e0f70f86608f89a2b2e03e064a80622dd3.json
Remove unused import. Missed out when reverting mutable dotenv. Signed-off-by: crynobone <crynobone@gmail.com>
src/Illuminate/Foundation/Testing/ApplicationTrait.php
@@ -1,6 +1,5 @@ <?php namespace Illuminate\Foundation\Testing; -use Dotenv; use Illuminate\Http\Request; use Illuminate\Contracts\Auth\Authenticatable as UserContract;
false
Other
laravel
framework
94484cd78c314625192d5255ad7c5192dfb00a2b.json
Update TestValidator due to code style
tests/Validation/ValidationValidatorTest.php
@@ -1390,23 +1390,23 @@ public function testValidateEach() $this->assertTrue($v->passes()); } - public function testValidateEachWithNonIndexedArray() - { - $trans = $this->getRealTranslator(); - $data = ['foobar' => [ - ['key' => 'foo', 'value' => 5], - ['key' => 'foo', 'value' => 10], - ['key' => 'foo', 'value' => 16] - ]]; - - $v = new Validator($trans, $data, ['foo' => 'Array']); - $v->each('foobar', ['key' => 'required', 'value' => 'numeric|min:6|max:14']); - $this->assertFalse($v->passes()); - - $v = new Validator($trans, $data, ['foo' => 'Array']); - $v->each('foobar', ['key' => 'required', 'value' => 'numeric|min:4|max:16']); - $this->assertTrue($v->passes()); - } + public function testValidateEachWithNonIndexedArray() + { + $trans = $this->getRealTranslator(); + $data = ['foobar' => [ + ['key' => 'foo', 'value' => 5], + ['key' => 'foo', 'value' => 10], + ['key' => 'foo', 'value' => 16] + ]]; + + $v = new Validator($trans, $data, ['foo' => 'Array']); + $v->each('foobar', ['key' => 'required', 'value' => 'numeric|min:6|max:14']); + $this->assertFalse($v->passes()); + + $v = new Validator($trans, $data, ['foo' => 'Array']); + $v->each('foobar', ['key' => 'required', 'value' => 'numeric|min:4|max:16']); + $this->assertTrue($v->passes()); + } public function testValidateEachWithNonArrayWithArrayRule() {
false
Other
laravel
framework
839c2f9a9f07948037f76be647a0131fbdc465a0.json
Fix config loading.
src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php
@@ -88,7 +88,7 @@ private function getConfigurationNesting(SplFileInfo $file) { $directory = dirname($file->getRealPath()); - if ($tree = trim(str_replace(config_path(), '', $directory), DIRECTORY_SEPARATOR)) + if ($tree = trim(str_replace(str_replace('\\', '/', config_path()), '', str_replace('\\', '/', $directory)), DIRECTORY_SEPARATOR)) { $tree = str_replace(DIRECTORY_SEPARATOR, '.', $tree).'.'; }
false
Other
laravel
framework
0889eb49a395d92785c52027a854654f2350ffa5.json
fix community contirbution that broke evrything.
src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php
@@ -88,7 +88,7 @@ private function getConfigurationNesting(SplFileInfo $file) { $directory = dirname($file->getRealPath()); - if ($tree = trim(str_replace(str_replace('/', '\\', config_path()), '', $directory), DIRECTORY_SEPARATOR)) + if ($tree = trim(str_replace(config_path(), '', $directory), DIRECTORY_SEPARATOR)) { $tree = str_replace(DIRECTORY_SEPARATOR, '.', $tree).'.'; }
false
Other
laravel
framework
69689061c177ae06c9da9015eede47cc24bed670.json
Fix Windows path Fix 9aed416700bc8e9082e8fb17c4a2b1579d3c3942
src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php
@@ -88,7 +88,7 @@ private function getConfigurationNesting(SplFileInfo $file) { $directory = dirname($file->getRealPath()); - if ($tree = trim(str_replace(config_path(), '', $directory), DIRECTORY_SEPARATOR)) + if ($tree = trim(str_replace(str_replace('/', '\\', config_path()), '', $directory), DIRECTORY_SEPARATOR)) { $tree = str_replace(DIRECTORY_SEPARATOR, '.', $tree).'.'; }
false
Other
laravel
framework
2a32d0526a690e78a5180750de511f934fdec67e.json
Add missing console dependency
src/Illuminate/Console/composer.json
@@ -11,7 +11,8 @@ "require": { "php": ">=5.4.0", "illuminate/contracts": "5.0.*", - "symfony/console": "2.6.*" + "symfony/console": "2.6.*", + "nesbot/carbon": "~1.0" }, "autoload": { "psr-4": {
false
Other
laravel
framework
389bc84afdff2d51fc9f47dfca897f135e1f8159.json
Remove useless brackets
src/Illuminate/Database/Eloquent/Collection.php
@@ -106,7 +106,7 @@ public function max($key) { return $this->reduce(function($result, $item) use ($key) { - return (is_null($result) || $item->{$key} > $result) ? $item->{$key} : $result; + return is_null($result) || $item->{$key} > $result ? $item->{$key} : $result; }); } @@ -120,7 +120,7 @@ public function min($key) { return $this->reduce(function($result, $item) use ($key) { - return (is_null($result) || $item->{$key} < $result) ? $item->{$key} : $result; + return is_null($result) || $item->{$key} < $result ? $item->{$key} : $result; }); }
true
Other
laravel
framework
389bc84afdff2d51fc9f47dfca897f135e1f8159.json
Remove useless brackets
src/Illuminate/Database/Eloquent/Model.php
@@ -1060,7 +1060,7 @@ protected function getBelongsToManyCaller() { $caller = $trace['function']; - return ( ! in_array($caller, Model::$manyMethods) && $caller != $self); + return ! in_array($caller, Model::$manyMethods) && $caller != $self; }); return ! is_null($caller) ? $caller['function'] : null; @@ -3289,8 +3289,8 @@ public function offsetUnset($offset) */ public function __isset($key) { - return ((isset($this->attributes[$key]) || isset($this->relations[$key])) || - ($this->hasGetMutator($key) && ! is_null($this->getAttributeValue($key)))); + return (isset($this->attributes[$key]) || isset($this->relations[$key])) || + ($this->hasGetMutator($key) && ! is_null($this->getAttributeValue($key))); } /**
true
Other
laravel
framework
389bc84afdff2d51fc9f47dfca897f135e1f8159.json
Remove useless brackets
src/Illuminate/Database/Query/Builder.php
@@ -528,7 +528,7 @@ protected function invalidOperatorAndValue($operator, $value) { $isOperator = in_array($operator, $this->operators); - return ($isOperator && $operator != '=' && is_null($value)); + return $isOperator && $operator != '=' && is_null($value); } /**
true
Other
laravel
framework
389bc84afdff2d51fc9f47dfca897f135e1f8159.json
Remove useless brackets
src/Illuminate/Foundation/Console/RouteListCommand.php
@@ -192,8 +192,8 @@ protected function getControllerMiddlewareFromInstance($controller, $method) */ protected function methodExcludedByOptions($method, array $options) { - return (( ! empty($options['only']) && ! in_array($method, (array) $options['only'])) || - ( ! empty($options['except']) && in_array($method, (array) $options['except']))); + return ( ! empty($options['only']) && ! in_array($method, (array) $options['only'])) || + ( ! empty($options['except']) && in_array($method, (array) $options['except'])); } /**
true
Other
laravel
framework
389bc84afdff2d51fc9f47dfca897f135e1f8159.json
Remove useless brackets
src/Illuminate/Routing/ControllerDispatcher.php
@@ -141,8 +141,8 @@ protected function getMiddleware($instance, $method) */ public function methodExcludedByOptions($method, array $options) { - return (( ! empty($options['only']) && ! in_array($method, (array) $options['only'])) || - ( ! empty($options['except']) && in_array($method, (array) $options['except']))); + return ( ! empty($options['only']) && ! in_array($method, (array) $options['only'])) || + ( ! empty($options['except']) && in_array($method, (array) $options['except'])); } /**
true
Other
laravel
framework
389bc84afdff2d51fc9f47dfca897f135e1f8159.json
Remove useless brackets
src/Illuminate/Routing/Router.php
@@ -1107,7 +1107,7 @@ protected function filterSupportsMethod($filter, $method) { $methods = $filter['methods']; - return (is_null($methods) || in_array($method, $methods)); + return is_null($methods) || in_array($method, $methods); } /** @@ -1261,7 +1261,7 @@ public function has($name) */ public function currentRouteName() { - return ($this->current()) ? $this->current()->getName() : null; + return $this->current() ? $this->current()->getName() : null; } /** @@ -1291,7 +1291,7 @@ public function is() */ public function currentRouteNamed($name) { - return ($this->current()) ? $this->current()->getName() == $name : false; + return $this->current() ? $this->current()->getName() == $name : false; } /**
true
Other
laravel
framework
389bc84afdff2d51fc9f47dfca897f135e1f8159.json
Remove useless brackets
src/Illuminate/Support/MessageBag.php
@@ -118,7 +118,7 @@ public function first($key = null, $format = null) { $messages = is_null($key) ? $this->all($format) : $this->get($key, $format); - return (count($messages) > 0) ? $messages[0] : ''; + return count($messages) > 0 ? $messages[0] : ''; } /** @@ -196,7 +196,7 @@ protected function transform($messages, $format, $messageKey) */ protected function checkFormat($format) { - return ($format === null) ? $this->format : $format; + return $format ?: $this->format; } /**
true
Other
laravel
framework
389bc84afdff2d51fc9f47dfca897f135e1f8159.json
Remove useless brackets
src/Illuminate/Validation/Validator.php
@@ -753,7 +753,7 @@ protected function validateSame($attribute, $value, $parameters) $other = array_get($this->data, $parameters[0]); - return (isset($other) && $value == $other); + return isset($other) && $value == $other; } /** @@ -770,7 +770,7 @@ protected function validateDifferent($attribute, $value, $parameters) $other = array_get($this->data, $parameters[0]); - return (isset($other) && $value != $other); + return isset($other) && $value != $other; } /** @@ -786,7 +786,7 @@ protected function validateAccepted($attribute, $value) { $acceptable = array('yes', 'on', '1', 1, true, 'true'); - return ($this->validateRequired($attribute, $value) && in_array($value, $acceptable, true)); + return $this->validateRequired($attribute, $value) && in_array($value, $acceptable, true); } /**
true
Other
laravel
framework
2b59a8ff744a490a9f4f5f16057386ef7b79f6e6.json
Use str_random instead of str_shuffle.
src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php
@@ -166,11 +166,7 @@ public function deleteExpired() */ public function createNewToken(CanResetPasswordContract $user) { - $email = $user->getEmailForPasswordReset(); - - $value = str_shuffle(sha1($email.spl_object_hash($this).microtime(true))); - - return hash_hmac('sha1', $value, $this->hashKey); + return hash_hmac('sha256', str_random(40), $this->hashKey); } /**
false
Other
laravel
framework
605e7f0dc56da4e29fd06e332c33e60f23b80b38.json
Fix some bugs in contains.
src/Illuminate/Database/Eloquent/Collection.php
@@ -67,12 +67,22 @@ public function add($item) */ public function contains($key, $value = null) { - if (func_num_args() == 1) + if (func_num_args() == 1 && ! $key instanceof Closure) { - return ! is_null($this->find($key)); + $key = $key instanceof Model ? $key->getKey() : $key; + + return $this->filter(function($m) use ($key) + { + return $m->getKey() === $key; + + })->count() > 0; + } + elseif (func_num_args() == 2) + { + return $this->where($key, $value)->count() > 0; } - return parent::contains($key, $value); + return parent::contains($key); } /**
false
Other
laravel
framework
3f23f3a54c9de14e13a87a1704eeff6d5790cb89.json
Return payload - fixes #7617
src/Illuminate/Queue/Jobs/SyncJob.php
@@ -49,7 +49,7 @@ public function fire() */ public function getRawBody() { - // + return $this->payload; } /**
false
Other
laravel
framework
9e07a6870b44e7a70155c58a60b51eed22984d0e.json
Use FQCN for Auth facade
src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php
@@ -1,7 +1,7 @@ <?php namespace Illuminate\Foundation\Auth; -use Auth; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Registrar;
false
Other
laravel
framework
9f52c6ff60134d709fc13f1201a27f87c81bf50f.json
Run tests on 7.0.
.travis.yml
@@ -4,8 +4,13 @@ php: - 5.4 - 5.5 - 5.6 + - 7.0 - hhvm +matrix: + allow_failures: + - php: 7.0 + sudo: false install: travis_retry composer install --no-interaction --prefer-source
false
Other
laravel
framework
061a24a2c1b1898bf39997bade3105867c848f7f.json
Use fallback in Translation::choice Fixes #7490
src/Illuminate/Translation/Translator.php
@@ -162,7 +162,7 @@ protected function sortReplacements(array $replace) */ public function choice($key, $number, array $replace = array(), $locale = null) { - $line = $this->get($key, $replace, $locale = $locale ?: $this->locale); + $line = $this->get($key, $replace, $locale = $locale ?: $this->locale ?: $this->fallback); $replace['count'] = $number;
false