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 | 8f1c4334297d4aad9ccbd3bac7b894b3ff662855.json | Prevent array_forget() from mixing up references | src/Illuminate/Support/Arr.php | @@ -176,6 +176,8 @@ public static function flatten($array)
*/
public static function forget(&$array, $keys)
{
+ $original =& $array;
+
foreach ((array) $keys as $key)
{
$parts = explode('.', $key);
@@ -191,6 +193,9 @@ public static function forget(&$array, $keys)
}
unset($array[array_shift($parts)]);
+
+ // clean up after each pass
+ $array =& $original;
}
}
| true |
Other | laravel | framework | 8f1c4334297d4aad9ccbd3bac7b894b3ff662855.json | Prevent array_forget() from mixing up references | tests/Support/SupportHelpersTest.php | @@ -47,6 +47,11 @@ public function testArrayForget()
$this->assertFalse(isset($array['names']['developer']));
$this->assertFalse(isset($array['names']['otherDeveloper']));
$this->assertTrue(isset($array['names']['thirdDeveloper']));
+
+ $array = ['names' => ['developer' => 'taylor', 'otherDeveloper' => 'dayle'], 'otherNames' => ['developer' => 'Lucas', 'otherDeveloper' => 'Graham']];
+ array_forget($array, ['names.developer', 'otherNames.otherDeveloper']);
+ $expected = ['names' => ['otherDeveloper' => 'dayle'], 'otherNames' => ['developer' => 'Lucas']];
+ $this->assertEquals($expected, $array);
}
| true |
Other | laravel | framework | fef787ba94e20c0942274e68fa10ed84f91c8a2e.json | Rmove useless use in commands | src/Illuminate/Database/Console/Migrations/StatusCommand.php | @@ -1,7 +1,6 @@
<?php namespace Illuminate\Database\Console\Migrations;
use Illuminate\Database\Migrations\Migrator;
-use Symfony\Component\Console\Input\InputOption;
class StatusCommand extends BaseCommand {
| true |
Other | laravel | framework | fef787ba94e20c0942274e68fa10ed84f91c8a2e.json | Rmove useless use in commands | src/Illuminate/Foundation/Console/RouteCacheCommand.php | @@ -3,8 +3,6 @@
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Routing\RouteCollection;
-use Symfony\Component\Console\Input\InputOption;
-use Symfony\Component\Console\Input\InputArgument;
class RouteCacheCommand extends Command {
| true |
Other | laravel | framework | fef787ba94e20c0942274e68fa10ed84f91c8a2e.json | Rmove useless use in commands | src/Illuminate/Foundation/Console/RouteClearCommand.php | @@ -1,10 +1,7 @@
<?php namespace Illuminate\Foundation\Console;
-use Illuminate\Routing\Router;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
-use Symfony\Component\Console\Input\InputOption;
-use Symfony\Component\Console\Input\InputArgument;
class RouteClearCommand extends Command {
| true |
Other | laravel | framework | 630a717c25e5f443f3e0c9dce053581be7768e0a.json | Add note about changed instance to changes file | src/Illuminate/Foundation/changes.json | @@ -11,7 +11,8 @@
{"message": "Passing an Eloquent model to a URL generator method will now automatically pull its ID.", "backport": null},
{"message": "Make both {{ }} and {{{ }}} escape values by default, new {!! !!} construct to echo raw data.", "backport": null},
{"message": "Add 'after' callback to Validator.", "backport": null},
- {"message": "Returning 'false' from a database ::chunk operation will stop processing records.", "backport": null}
+ {"message": "Returning 'false' from a database ::chunk operation will stop processing records.", "backport": null},
+ {"message": "The instance 'swift.transport' is now an instance of 'Illuminate\\Mail\\TransportManager'.", "backport": null}
],
"4.2.*": [
{"message": "View and Pagination 'Environment' classes renamed to 'Factory'.", "backport": null}, | false |
Other | laravel | framework | 5281856203bdafc48025b2c4bf6dfef0a5496678.json | Remove prefix from tagged cache get. Unnecessary. | src/Illuminate/Cache/TaggedCache.php | @@ -134,11 +134,11 @@ public function forever($key, $value)
* Remove an item from the cache.
*
* @param string $key
- * @return void
+ * @return bool
*/
public function forget($key)
{
- $this->store->forget($this->taggedItemKey($key));
+ return $this->store->forget($this->taggedItemKey($key));
}
/**
@@ -210,7 +210,7 @@ public function rememberForever($key, Closure $callback)
*/
public function taggedItemKey($key)
{
- return $this->getPrefix().sha1($this->tags->getNamespace()).':'.$key;
+ return sha1($this->tags->getNamespace()).':'.$key;
}
/** | false |
Other | laravel | framework | cc148714b51b56e5eb4701deea8d3be8dcb8e1b6.json | Fix white space. | src/Illuminate/Database/Eloquent/Relations/MorphPivot.php | @@ -70,9 +70,9 @@ public function setMorphType($morphType)
*/
public function setMorphClass($morphClass)
{
- $this->morphClass = $morphClass;
+ $this->morphClass = $morphClass;
- return $this;
+ return $this;
}
| false |
Other | laravel | framework | e1426baacf0c344f2ed241f0a30d49a09cc0abe8.json | Remove helpers that depend on illuminate/html | src/Illuminate/Foundation/helpers.php | @@ -176,74 +176,6 @@ function info($message, $context = array())
}
}
-if ( ! function_exists('link_to'))
-{
- /**
- * Generate a HTML link.
- *
- * @param string $url
- * @param string $title
- * @param array $attributes
- * @param bool $secure
- * @return string
- */
- function link_to($url, $title = null, $attributes = array(), $secure = null)
- {
- return app('html')->link($url, $title, $attributes, $secure);
- }
-}
-
-if ( ! function_exists('link_to_asset'))
-{
- /**
- * Generate a HTML link to an asset.
- *
- * @param string $url
- * @param string $title
- * @param array $attributes
- * @param bool $secure
- * @return string
- */
- function link_to_asset($url, $title = null, $attributes = array(), $secure = null)
- {
- return app('html')->linkAsset($url, $title, $attributes, $secure);
- }
-}
-
-if ( ! function_exists('link_to_route'))
-{
- /**
- * Generate a HTML link to a named route.
- *
- * @param string $name
- * @param string $title
- * @param array $parameters
- * @param array $attributes
- * @return string
- */
- function link_to_route($name, $title = null, $parameters = array(), $attributes = array())
- {
- return app('html')->linkRoute($name, $title, $parameters, $attributes);
- }
-}
-
-if ( ! function_exists('link_to_action'))
-{
- /**
- * Generate a HTML link to a controller action.
- *
- * @param string $action
- * @param string $title
- * @param array $parameters
- * @param array $attributes
- * @return string
- */
- function link_to_action($action, $title = null, $parameters = array(), $attributes = array())
- {
- return app('html')->linkAction($action, $title, $parameters, $attributes);
- }
-}
-
if ( ! function_exists('patch'))
{
/** | false |
Other | laravel | framework | f74c73a5ec691285bf79cc59b595fd4e1f39b42b.json | Use morph class as morph type value. | src/Illuminate/Database/Eloquent/Relations/MorphPivot.php | @@ -30,7 +30,7 @@ class MorphPivot extends Pivot {
*/
protected function setKeysForSaveQuery(Builder $query)
{
- $query->where($this->morphType, $this->getAttribute($this->morphType));
+ $query->where($this->morphType, $this->morphClass);
return parent::setKeysForSaveQuery($query);
}
@@ -44,7 +44,7 @@ public function delete()
{
$query = $this->getDeleteQuery();
- $query->where($this->morphType, $this->getAttribute($this->morphType));
+ $query->where($this->morphType, $this->morphClass);
return $query->delete();
} | false |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Contracts/Support/Arrayable.php | @@ -1,6 +1,6 @@
<?php namespace Illuminate\Contracts\Support;
-interface ArrayableInterface {
+interface Arrayable {
/**
* Get the instance as an array. | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Contracts/Support/Jsonable.php | @@ -1,6 +1,6 @@
<?php namespace Illuminate\Contracts\Support;
-interface JsonableInterface {
+interface Jsonable {
/**
* Convert the object to its JSON representation. | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Contracts/Support/MessageProvider.php | @@ -1,6 +1,6 @@
<?php namespace Illuminate\Contracts\Support;
-interface MessageProviderInterface {
+interface MessageProvider {
/**
* Get the messages for the instance.
| true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Contracts/Support/Renderable.php | @@ -1,6 +1,6 @@
<?php namespace Illuminate\Contracts\Support;
-interface RenderableInterface {
+interface Renderable {
/**
* Get the evaluated contents of the object. | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Contracts/Support/ResponsePreparer.php | @@ -1,6 +1,6 @@
<?php namespace Illuminate\Contracts\Support;
-interface ResponsePreparerInterface {
+interface ResponsePreparer {
/**
* Prepare the given value as a Response object. | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Contracts/View/View.php | @@ -1,8 +1,8 @@
<?php namespace Illuminate\Contracts\View;
-use Illuminate\Contracts\Support\RenderableInterface;
+use Illuminate\Contracts\Support\Renderable;
-interface View extends RenderableInterface {
+interface View extends Renderable {
/**
* Add a piece of data to the view. | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Database/Eloquent/Model.php | @@ -5,14 +5,14 @@
use Carbon\Carbon;
use LogicException;
use JsonSerializable;
+use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Events\Dispatcher;
+use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Routing\UrlRoutable;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphTo;
-use Illuminate\Contracts\Support\JsonableInterface;
-use Illuminate\Contracts\Support\ArrayableInterface;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Eloquent\Relations\MorphOne;
use Illuminate\Database\Eloquent\Relations\MorphMany;
@@ -23,7 +23,7 @@
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
use Illuminate\Database\ConnectionResolverInterface as Resolver;
-abstract class Model implements ArrayAccess, ArrayableInterface, JsonableInterface, UrlRoutable, JsonSerializable {
+abstract class Model implements ArrayAccess, Arrayable, Jsonable, UrlRoutable, JsonSerializable {
/**
* The connection name for the model.
@@ -2299,7 +2299,7 @@ public function relationsToArray()
// If the values implements the Arrayable interface we can just call this
// toArray method on the instances which will convert both models and
// collections to their proper array form and we'll set the values.
- if ($value instanceof ArrayableInterface)
+ if ($value instanceof Arrayable)
{
$relation = $value->toArray();
}
@@ -2494,7 +2494,7 @@ protected function mutateAttributeForArray($key, $value)
{
$value = $this->mutateAttribute($key, $value);
- return $value instanceof ArrayableInterface ? $value->toArray() : $value;
+ return $value instanceof Arrayable ? $value->toArray() : $value;
}
/** | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Exception/Handler.php | @@ -4,7 +4,7 @@
use Exception;
use ErrorException;
use ReflectionFunction;
-use Illuminate\Contracts\Support\ResponsePreparerInterface;
+use Illuminate\Contracts\Support\ResponsePreparer;
use Illuminate\Contracts\Exception\Handler as HandlerContract;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\Debug\Exception\FatalErrorException as FatalError;
@@ -14,7 +14,7 @@ class Handler implements HandlerContract {
/**
* The response preparer implementation.
*
- * @var \Illuminate\Contracts\Support\ResponsePreparerInterface
+ * @var \Illuminate\Contracts\Support\ResponsePreparer
*/
protected $responsePreparer;
@@ -56,13 +56,13 @@ class Handler implements HandlerContract {
/**
* Create a new error handler instance.
*
- * @param \Illuminate\Contracts\Support\ResponsePreparerInterface $responsePreparer
+ * @param \Illuminate\Contracts\Support\ResponsePreparer $responsePreparer
* @param \Illuminate\Exception\ExceptionDisplayerInterface $plainDisplayer
* @param \Illuminate\Exception\ExceptionDisplayerInterface $debugDisplayer
* @param bool $debug
* @return void
*/
- public function __construct(ResponsePreparerInterface $responsePreparer,
+ public function __construct(ResponsePreparer $responsePreparer,
ExceptionDisplayerInterface $plainDisplayer,
ExceptionDisplayerInterface $debugDisplayer,
$debug = true) | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Foundation/Application.php | @@ -10,13 +10,13 @@
use Illuminate\Support\ServiceProvider;
use Illuminate\Events\EventServiceProvider;
use Illuminate\Routing\RoutingServiceProvider;
+use Illuminate\Contracts\Support\ResponsePreparer;
use Illuminate\Exception\ExceptionServiceProvider;
use Illuminate\Config\FileEnvironmentVariablesLoader;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\TerminableInterface;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\Debug\Exception\FatalErrorException;
-use Illuminate\Contracts\Support\ResponsePreparerInterface;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -25,7 +25,7 @@
class Application extends Container implements HttpKernelInterface,
TerminableInterface,
ApplicationContract,
- ResponsePreparerInterface {
+ ResponsePreparer {
/**
* The Laravel framework version. | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Foundation/Console/Optimize/config.php | @@ -4,19 +4,19 @@
return array_map('realpath', array(
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Container/Container.php',
- $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/RenderableInterface.php',
- $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/ResponsePreparerInterface.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/Renderable.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/ResponsePreparer.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Config/Repository.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Url/Generator.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Events/Dispatcher.php',
- $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/ArrayableInterface.php',
- $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/JsonableInterface.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/Arrayable.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/Jsonable.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Cookie/Factory.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Cookie/QueueingFactory.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Encryption/Encrypter.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/Registrar.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/View/Factory.php',
- $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/MessageProviderInterface.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/MessageProvider.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/View/View.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Container/Container.php',
$basePath.'/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php', | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Http/JsonResponse.php | @@ -1,6 +1,6 @@
<?php namespace Illuminate\Http;
-use Illuminate\Contracts\Support\JsonableInterface;
+use Illuminate\Contracts\Support\Jsonable;
class JsonResponse extends \Symfony\Component\HttpFoundation\JsonResponse {
@@ -45,7 +45,7 @@ public function getData($assoc = false, $depth = 512)
*/
public function setData($data = array())
{
- $this->data = $data instanceof JsonableInterface
+ $this->data = $data instanceof Jsonable
? $data->toJson($this->jsonOptions)
: json_encode($data, $this->jsonOptions);
| true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Http/RedirectResponse.php | @@ -4,7 +4,7 @@
use Illuminate\Support\ViewErrorBag;
use Symfony\Component\HttpFoundation\Cookie;
use Illuminate\Session\Store as SessionStore;
-use Illuminate\Contracts\Support\MessageProviderInterface;
+use Illuminate\Contracts\Support\MessageProvider;
class RedirectResponse extends \Symfony\Component\HttpFoundation\RedirectResponse {
@@ -111,7 +111,7 @@ public function exceptInput()
/**
* Flash a container of errors to the session.
*
- * @param \Illuminate\Contracts\Support\MessageProviderInterface|array $provider
+ * @param \Illuminate\Contracts\Support\MessageProvider|array $provider
* @param string $key
* @return $this
*/
@@ -129,12 +129,12 @@ public function withErrors($provider, $key = 'default')
/**
* Parse the given errors into an appropriate value.
*
- * @param \Illuminate\Contracts\Support\MessageProviderInterface|array $provider
+ * @param \Illuminate\Contracts\Support\MessageProvider|array $provider
* @return \Illuminate\Support\MessageBag
*/
protected function parseErrors($provider)
{
- if ($provider instanceof MessageProviderInterface)
+ if ($provider instanceof MessageProvider)
{
return $provider->getMessageBag();
} | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Http/Response.php | @@ -1,8 +1,8 @@
<?php namespace Illuminate\Http;
use ArrayObject;
-use Illuminate\Contracts\Support\JsonableInterface;
-use Illuminate\Contracts\Support\RenderableInterface;
+use Illuminate\Contracts\Support\Jsonable;
+use Illuminate\Contracts\Support\Renderable;
class Response extends \Symfony\Component\HttpFoundation\Response {
@@ -35,10 +35,10 @@ public function setContent($content)
$content = $this->morphToJson($content);
}
- // If this content implements the "RenderableInterface", then we will call the
+ // If this content implements the "Renderable" interface then we will call the
// render method on the object so we will avoid any "__toString" exceptions
// that might be thrown and have their errors obscured by PHP's handling.
- elseif ($content instanceof RenderableInterface)
+ elseif ($content instanceof Renderable)
{
$content = $content->render();
}
@@ -54,7 +54,7 @@ public function setContent($content)
*/
protected function morphToJson($content)
{
- if ($content instanceof JsonableInterface) return $content->toJson();
+ if ($content instanceof Jsonable) return $content->toJson();
return json_encode($content);
}
@@ -67,7 +67,7 @@ protected function morphToJson($content)
*/
protected function shouldBeJson($content)
{
- return $content instanceof JsonableInterface ||
+ return $content instanceof Jsonable ||
$content instanceof ArrayObject ||
is_array($content);
} | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Log/Writer.php | @@ -6,10 +6,10 @@
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\ErrorLogHandler;
use Monolog\Handler\RotatingFileHandler;
+use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Events\Dispatcher;
+use Illuminate\Contracts\Support\Arrayable;
use Psr\Log\LoggerInterface as PsrLoggerInterface;
-use Illuminate\Contracts\Support\JsonableInterface;
-use Illuminate\Contracts\Support\ArrayableInterface;
use Illuminate\Contracts\Logging\Log as LogContract;
class Writer implements LogContract, PsrLoggerInterface {
@@ -278,11 +278,11 @@ protected function formatMessage($message)
{
return var_export($message, true);
}
- elseif ($message instanceof JsonableInterface)
+ elseif ($message instanceof Jsonable)
{
return $message->toJson();
}
- elseif ($message instanceof ArrayableInterface)
+ elseif ($message instanceof Arrayable)
{
return var_export($message->toArray(), true);
} | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Pagination/Paginator.php | @@ -5,10 +5,10 @@
use ArrayIterator;
use IteratorAggregate;
use Illuminate\Support\Collection;
-use Illuminate\Contracts\Support\JsonableInterface;
-use Illuminate\Contracts\Support\ArrayableInterface;
+use Illuminate\Contracts\Support\Jsonable;
+use Illuminate\Contracts\Support\Arrayable;
-class Paginator implements ArrayableInterface, ArrayAccess, Countable, IteratorAggregate, JsonableInterface {
+class Paginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable {
/**
* The pagination factory. | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Support/Collection.php | @@ -7,10 +7,10 @@
use CachingIterator;
use JsonSerializable;
use IteratorAggregate;
-use Illuminate\Contracts\Support\JsonableInterface;
-use Illuminate\Contracts\Support\ArrayableInterface;
+use Illuminate\Contracts\Support\Jsonable;
+use Illuminate\Contracts\Support\Arrayable;
-class Collection implements ArrayAccess, ArrayableInterface, Countable, IteratorAggregate, JsonableInterface, JsonSerializable {
+class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable {
/**
* The items contained in the collection.
@@ -91,7 +91,7 @@ public function contains($value)
/**
* Diff the collection with the given items.
*
- * @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\ArrayableInterface|array $items
+ * @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|array $items
* @return static
*/
public function diff($items)
@@ -269,7 +269,7 @@ public function implode($value, $glue = null)
/**
* Intersect the collection with the given items.
*
- * @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\ArrayableInterface|array $items
+ * @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|array $items
* @return static
*/
public function intersect($items)
@@ -333,7 +333,7 @@ public function map(Closure $callback)
/**
* Merge the collection with the given items.
*
- * @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\ArrayableInterface|array $items
+ * @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|array $items
* @return static
*/
public function merge($items)
@@ -696,7 +696,7 @@ public function toArray()
{
return array_map(function($value)
{
- return $value instanceof ArrayableInterface ? $value->toArray() : $value;
+ return $value instanceof Arrayable ? $value->toArray() : $value;
}, $this->items);
}
@@ -816,9 +816,9 @@ public function __toString()
}
/**
- * Results array of items from Collection or ArrayableInterface.
+ * Results array of items from Collection or Arrayable.
*
- * @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\ArrayableInterface|array $items
+ * @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|array $items
* @return array
*/
protected function getArrayableItems($items)
@@ -827,7 +827,7 @@ protected function getArrayableItems($items)
{
$items = $items->all();
}
- elseif ($items instanceof ArrayableInterface)
+ elseif ($items instanceof Arrayable)
{
$items = $items->toArray();
}
| true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Support/Facades/Response.php | @@ -2,9 +2,9 @@
use Illuminate\Support\Str;
use Illuminate\Http\JsonResponse;
+use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Traits\MacroableTrait;
use Illuminate\Http\Response as IlluminateResponse;
-use Illuminate\Contracts\Support\ArrayableInterface;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
@@ -52,7 +52,7 @@ public static function view($view, $data = array(), $status = 200, array $header
*/
public static function json($data = array(), $status = 200, array $headers = array(), $options = 0)
{
- if ($data instanceof ArrayableInterface)
+ if ($data instanceof Arrayable)
{
$data = $data->toArray();
} | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Support/Fluent.php | @@ -2,10 +2,10 @@
use ArrayAccess;
use JsonSerializable;
-use Illuminate\Contracts\Support\JsonableInterface;
-use Illuminate\Contracts\Support\ArrayableInterface;
+use Illuminate\Contracts\Support\Jsonable;
+use Illuminate\Contracts\Support\Arrayable;
-class Fluent implements ArrayAccess, ArrayableInterface, JsonableInterface, JsonSerializable {
+class Fluent implements ArrayAccess, Arrayable, Jsonable, JsonSerializable {
/**
* All of the attributes set on the container. | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Support/MessageBag.php | @@ -2,11 +2,11 @@
use Countable;
use JsonSerializable;
-use Illuminate\Contracts\Support\JsonableInterface;
-use Illuminate\Contracts\Support\ArrayableInterface;
-use Illuminate\Contracts\Support\MessageProviderInterface;
+use Illuminate\Contracts\Support\Jsonable;
+use Illuminate\Contracts\Support\Arrayable;
+use Illuminate\Contracts\Support\MessageProvider;
-class MessageBag implements ArrayableInterface, Countable, JsonableInterface, MessageProviderInterface, JsonSerializable {
+class MessageBag implements Arrayable, Countable, Jsonable, MessageProvider, JsonSerializable {
/**
* All of the registered messages.
@@ -56,12 +56,12 @@ public function add($key, $message)
/**
* Merge a new array of messages into the bag.
*
- * @param \Illuminate\Contracts\Support\MessageProviderInterface|array $messages
+ * @param \Illuminate\Contracts\Support\MessageProvider|array $messages
* @return $this
*/
public function merge($messages)
{
- if ($messages instanceof MessageProviderInterface)
+ if ($messages instanceof MessageProvider)
{
$messages = $messages->getMessageBag()->getMessages();
}
| true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/Validation/Validator.php | @@ -7,11 +7,11 @@
use Illuminate\Support\MessageBag;
use Illuminate\Container\Container;
use Symfony\Component\HttpFoundation\File\File;
+use Illuminate\Contracts\Support\MessageProvider;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\HttpFoundation\File\UploadedFile;
-use Illuminate\Contracts\Support\MessageProviderInterface;
-class Validator implements MessageProviderInterface {
+class Validator implements MessageProvider {
/**
* The Translator implementation. | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/View/Factory.php | @@ -2,10 +2,10 @@
use Closure;
use Illuminate\Container\Container;
+use Illuminate\Contracts\Support\Arrayable;
use Illuminate\View\Engines\EngineResolver;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\View\Factory as FactoryContract;
-use Illuminate\Contracts\Support\ArrayableInterface as Arrayable;
class Factory implements FactoryContract {
| true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | src/Illuminate/View/View.php | @@ -3,11 +3,11 @@
use Closure;
use ArrayAccess;
use Illuminate\Support\MessageBag;
+use Illuminate\Contracts\Support\Arrayable;
use Illuminate\View\Engines\EngineInterface;
+use Illuminate\Contracts\Support\Renderable;
+use Illuminate\Contracts\Support\MessageProvider;
use Illuminate\Contracts\View\View as ViewContract;
-use Illuminate\Contracts\Support\RenderableInterface;
-use Illuminate\Contracts\Support\MessageProviderInterface;
-use Illuminate\Contracts\Support\ArrayableInterface as Arrayable;
class View implements ArrayAccess, ViewContract {
@@ -146,7 +146,7 @@ protected function gatherData()
foreach ($data as $key => $value)
{
- if ($value instanceof RenderableInterface)
+ if ($value instanceof Renderable)
{
$data[$key] = $value->render();
}
@@ -192,12 +192,12 @@ public function nest($key, $view, array $data = array())
/**
* Add validation errors to the view.
*
- * @param \Illuminate\Contracts\Support\MessageProviderInterface|array $provider
+ * @param \Illuminate\Contracts\Support\MessageProvider|array $provider
* @return $this
*/
public function withErrors($provider)
{
- if ($provider instanceof MessageProviderInterface)
+ if ($provider instanceof MessageProvider)
{
$this->with('errors', $provider->getMessageBag());
} | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | tests/Exception/HandlerTest.php | @@ -7,7 +7,7 @@ class HandlerTest extends PHPUnit_Framework_TestCase
{
protected function setUp()
{
- $this->responsePreparer = m::mock('Illuminate\Contracts\Support\ResponsePreparerInterface');
+ $this->responsePreparer = m::mock('Illuminate\Contracts\Support\ResponsePreparer');
$this->plainDisplayer = m::mock('Illuminate\Exception\ExceptionDisplayerInterface');
$this->debugDisplayer = m::mock('Illuminate\Exception\ExceptionDisplayerInterface');
$this->handler = new Handler($this->responsePreparer, $this->plainDisplayer, $this->debugDisplayer); | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | tests/Http/HttpResponseTest.php | @@ -3,7 +3,7 @@
use Mockery as m;
use Illuminate\Http\Request;
use Illuminate\Http\RedirectResponse;
-use Illuminate\Contracts\Support\JsonableInterface;
+use Illuminate\Contracts\Support\Jsonable;
class HttpResponseTest extends PHPUnit_Framework_TestCase {
@@ -28,7 +28,7 @@ public function testJsonResponsesAreConvertedAndHeadersAreSet()
public function testRenderablesAreRendered()
{
- $mock = m::mock('Illuminate\Contracts\Support\RenderableInterface');
+ $mock = m::mock('Illuminate\Contracts\Support\Renderable');
$mock->shouldReceive('render')->once()->andReturn('foo');
$response = new Illuminate\Http\Response($mock);
$this->assertEquals('foo', $response->getContent());
@@ -141,7 +141,7 @@ public function testFlashingErrorsOnRedirect()
$response->setSession($session = m::mock('Illuminate\Session\Store'));
$session->shouldReceive('get')->with('errors', m::type('Illuminate\Support\ViewErrorBag'))->andReturn(new Illuminate\Support\ViewErrorBag);
$session->shouldReceive('flash')->once()->with('errors', m::type('Illuminate\Support\ViewErrorBag'));
- $provider = m::mock('Illuminate\Contracts\Support\MessageProviderInterface');
+ $provider = m::mock('Illuminate\Contracts\Support\MessageProvider');
$provider->shouldReceive('getMessageBag')->once()->andReturn(new Illuminate\Support\MessageBag);
$response->withErrors($provider);
}
@@ -193,6 +193,6 @@ public function testMagicCallException()
}
-class JsonableStub implements JsonableInterface {
+class JsonableStub implements Jsonable {
public function toJson($options = 0) { return 'foo'; }
} | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | tests/Support/SupportCollectionTest.php | @@ -48,9 +48,9 @@ public function testEmptyCollectionIsEmpty()
public function testToArrayCallsToArrayOnEachItemInCollection()
{
- $item1 = m::mock('Illuminate\Contracts\Support\ArrayableInterface');
+ $item1 = m::mock('Illuminate\Contracts\Support\Arrayable');
$item1->shouldReceive('toArray')->once()->andReturn('foo.array');
- $item2 = m::mock('Illuminate\Contracts\Support\ArrayableInterface');
+ $item2 = m::mock('Illuminate\Contracts\Support\Arrayable');
$item2->shouldReceive('toArray')->once()->andReturn('bar.array');
$c = new Collection(array($item1, $item2));
$results = $c->toArray();
| true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | tests/Support/SupportFacadeResponseTest.php | @@ -13,7 +13,7 @@ public function tearDown()
public function testArrayableSendAsJson()
{
- $data = m::mock('Illuminate\Contracts\Support\ArrayableInterface');
+ $data = m::mock('Illuminate\Contracts\Support\Arrayable');
$data->shouldReceive('toArray')->andReturn(array('foo' => 'bar'));
$response = Response::json($data); | true |
Other | laravel | framework | 26982391b8ecf8f9160cec324c74ded96861f2b6.json | Rename some interfaces for consistency. | tests/View/ViewTest.php | @@ -2,7 +2,7 @@
use Mockery as m;
use Illuminate\View\View;
-use Illuminate\Contracts\Support\ArrayableInterface;
+use Illuminate\Contracts\Support\Arrayable;
class ViewTest extends PHPUnit_Framework_TestCase {
@@ -91,7 +91,7 @@ public function testViewNestBindsASubView()
public function testViewAcceptsArrayableImplementations()
{
- $arrayable = m::mock('Illuminate\Contracts\Support\ArrayableInterface');
+ $arrayable = m::mock('Illuminate\Contracts\Support\Arrayable');
$arrayable->shouldReceive('toArray')->once()->andReturn(array('foo' => 'bar', 'baz' => array('qux', 'corge')));
$view = new View(
@@ -164,7 +164,7 @@ public function testViewGatherDataWithRenderable()
$view->getFactory()->shouldReceive('decrementRender')->once()->ordered();
$view->getFactory()->shouldReceive('flushSectionsIfDoneRendering')->once();
- $view->renderable = m::mock('Illuminate\Contracts\Support\RenderableInterface');
+ $view->renderable = m::mock('Illuminate\Contracts\Support\Renderable');
$view->renderable->shouldReceive('render')->once()->andReturn('text');
$view->render();
} | true |
Other | laravel | framework | e1aa4f27542adf21b4755b5f296b3639bc821fc1.json | Use proper assertions | tests/Auth/AuthDatabaseReminderRepositoryTest.php | @@ -22,7 +22,8 @@ public function testCreateInsertsNewRecordIntoTable()
$results = $repo->create($user);
- $this->assertTrue(is_string($results) and strlen($results) > 1);
+ $this->assertInternalType('string', $results);
+ $this->assertGreaterThan(1, strlen($results));
}
| true |
Other | laravel | framework | e1aa4f27542adf21b4755b5f296b3639bc821fc1.json | Use proper assertions | tests/Encryption/EncrypterTest.php | @@ -7,19 +7,19 @@ class EncrypterTest extends PHPUnit_Framework_TestCase {
public function testEncryption()
{
$e = $this->getEncrypter();
- $this->assertFalse('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' == $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'));
+ $this->assertNotEquals('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'));
$encrypted = $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
- $this->assertTrue('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' == $e->decrypt($encrypted));
+ $this->assertEquals('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', $e->decrypt($encrypted));
}
public function testEncryptionWithCustomCipher()
{
$e = $this->getEncrypter();
$e->setCipher(MCRYPT_RIJNDAEL_256);
- $this->assertFalse('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' == $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'));
+ $this->assertNotEquals('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'));
$encrypted = $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
- $this->assertTrue('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' == $e->decrypt($encrypted));
+ $this->assertEquals('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', $e->decrypt($encrypted));
}
/** | true |
Other | laravel | framework | e1aa4f27542adf21b4755b5f296b3639bc821fc1.json | Use proper assertions | tests/Session/SessionStoreTest.php | @@ -44,14 +44,14 @@ public function testSessionMigration()
$oldId = $session->getId();
$session->getHandler()->shouldReceive('destroy')->never();
$this->assertTrue($session->migrate());
- $this->assertFalse($oldId == $session->getId());
+ $this->assertNotEquals($oldId, $session->getId());
$session = $this->getSession();
$oldId = $session->getId();
$session->getHandler()->shouldReceive('destroy')->once()->with($oldId);
$this->assertTrue($session->migrate(true));
- $this->assertFalse($oldId == $session->getId());
+ $this->assertNotEquals($oldId, $session->getId());
}
@@ -61,7 +61,7 @@ public function testSessionRegeneration()
$oldId = $session->getId();
$session->getHandler()->shouldReceive('destroy')->never();
$this->assertTrue($session->regenerate());
- $this->assertFalse($oldId == $session->getId());
+ $this->assertNotEquals($oldId, $session->getId());
}
@@ -85,11 +85,11 @@ public function testSessionInvalidate()
$session = $this->getSession();
$oldId = $session->getId();
$session->set('foo','bar');
- $this->assertTrue(count($session->all()) > 0);
+ $this->assertGreaterThan(0, count($session->all()));
$session->getHandler()->shouldReceive('destroy')->never();
$this->assertTrue($session->invalidate());
- $this->assertFalse($oldId == $session->getId());
- $this->assertTrue(count($session->all()) == 0);
+ $this->assertNotEquals($oldId, $session->getId());
+ $this->assertCount(0, $session->all());
}
@@ -195,8 +195,8 @@ public function testReplace()
$session->set('foo', 'bar');
$session->set('qu', 'ux');
$session->replace(array('foo' => 'baz'));
- $this->assertTrue($session->get('foo') == 'baz');
- $this->assertTrue($session->get('qu') == 'ux');
+ $this->assertEquals('baz', $session->get('foo'));
+ $this->assertEquals('ux', $session->get('qu'));
}
@@ -206,7 +206,7 @@ public function testRemove()
$session->set('foo', 'bar');
$pulled = $session->remove('foo');
$this->assertFalse($session->has('foo'));
- $this->assertTrue($pulled == 'bar');
+ $this->assertEquals('bar', $pulled);
}
@@ -260,7 +260,7 @@ public function testHandlerNeedsRequest()
public function testToken()
{
$session = $this->getSession();
- $this->assertTrue($session->token() == $session->getToken());
+ $this->assertEquals($session->token(), $session->getToken());
}
| true |
Other | laravel | framework | 34f63cbdd84f686aba9283ec0c95be986fb06678.json | Add fresh method to model.
This method gets a fresh copy of the model using the ID from the
existing instance. | src/Illuminate/Database/Eloquent/Model.php | @@ -675,6 +675,19 @@ public static function findOrFail($id, $columns = array('*'))
throw (new ModelNotFoundException)->setModel(get_called_class());
}
+ /**
+ * Reload a fresh model instance from the database.
+ *
+ * @param array $with
+ * @return $this
+ */
+ public function fresh(array $with = array())
+ {
+ $key = $this->getKeyName();
+
+ return $this->exists ? static::with($with)->where($key, $this->getKey())->first() : null;
+ }
+
/**
* Eager load relations on the model.
* | false |
Other | laravel | framework | 1ff457f71b840fa1516be0458020feb0a4708d58.json | Remove duplicate entry. | src/Illuminate/Foundation/changes.json | @@ -8,7 +8,6 @@
{"message": "Added new FormRequest class for simpler validation and authorization.", "backport": null},
{"message": "Contracts for most major components of the framework.", "backport": null},
{"message": "Flysystem integration now included with framework.", "backport": null},
- {"message": "Dependency injection now possible on controller methods and route Closures.", "backport": null},
{"message": "Passing an Eloquent model to a URL generator method will now automatically pull its ID.", "backport": null}
],
"4.2.*": [ | false |
Other | laravel | framework | 2b9be838df5369d2ff78fc26ade43775b311b701.json | Add missing method. | src/Illuminate/Routing/UrlGenerator.php | @@ -549,6 +549,19 @@ public function setRequest(Request $request)
$this->request = $request;
}
+ /**
+ * Set the route collection.
+ *
+ * @param \Illuminate\Routing\RouteCollection $routes
+ * @return $this
+ */
+ public function setRoutes(RouteCollection $routes)
+ {
+ $this->routes = $routes;
+
+ return $this;
+ }
+
/**
* Set the root controller namespace.
*
| false |
Other | laravel | framework | ea3b8a3f535443b37f9bf29f2e15ab09f2a2460f.json | Fix bug in route caching and route names. | src/Illuminate/Routing/RouteServiceProvider.php | @@ -16,7 +16,10 @@ public function boot()
if ($this->app->routesAreCached())
{
- require $this->app->getRouteCachePath();
+ $this->app->booted(function()
+ {
+ require $this->app->getRouteCachePath();
+ });
}
else
{ | true |
Other | laravel | framework | ea3b8a3f535443b37f9bf29f2e15ab09f2a2460f.json | Fix bug in route caching and route names. | src/Illuminate/Routing/Router.php | @@ -1700,6 +1700,8 @@ public function setRoutes(RouteCollection $routes)
}
$this->routes = $routes;
+
+ $this->container->instance('routes', $this->routes);
}
/** | true |
Other | laravel | framework | ea3b8a3f535443b37f9bf29f2e15ab09f2a2460f.json | Fix bug in route caching and route names. | src/Illuminate/Routing/RoutingServiceProvider.php | @@ -55,10 +55,22 @@ protected function registerUrlGenerator()
// and all the registered routes will be available to the generator.
$routes = $app['router']->getRoutes();
- return new UrlGenerator($routes, $app->rebinding('request', function($app, $request)
+ $app->instance('routes', $routes);
+
+ $url = new UrlGenerator($routes, $app->rebinding('request', function($app, $request)
{
$app['url']->setRequest($request);
}));
+
+ // If the route collection is "rebound", for example, when the routes stay
+ // cached for the application, we will need to rebind the routes on the
+ // URL generator instance so it has the latest version of the routes.
+ $app->rebinding('routes', function($app, $routes)
+ {
+ $app['url']->setRoutes($routes);
+ });
+
+ return $url;
});
}
| true |
Other | laravel | framework | 01b54fbb86224b21786e6caa65bcbce3450aa81f.json | Update changes file. | src/Illuminate/Foundation/changes.json | @@ -31,7 +31,8 @@
{"message": "Allow 'where' route constraints to be passed in array definition of Route.", "backport": null},
{"message": "Properly support Route 'where' constraints on a Route group.", "backport": null},
{"message": "When 'increment' or 'decrement' is called on a single Model instance, the local attribute value is updated as well.", "backport": null},
- {"message": "Automatically retry queries on database connections that have 'gone away'.", "backport": null}
+ {"message": "Automatically retry queries on database connections that have 'gone away'.", "backport": null},
+ {"message": "Allow accessing of read / write database connections using ::read and ::write syntax.", "backport": null}
],
"4.1.*": [
{"message": "Added new SSH task runner tools.", "backport": null}, | false |
Other | laravel | framework | 7602d93ce35e8f0baf9915ebc8be4d885ee0259e.json | Flush the application after each test. | src/Illuminate/Container/Container.php | @@ -872,6 +872,19 @@ public function forgetInstances()
$this->instances = array();
}
+ /**
+ * Flush the container of all bindings and resolved instances.
+ *
+ * @return void
+ */
+ public function flush()
+ {
+ $this->aliases = [];
+ $this->resolved = [];
+ $this->bindings = [];
+ $this->instances = [];
+ }
+
/**
* Determine if a given offset exists.
* | true |
Other | laravel | framework | 7602d93ce35e8f0baf9915ebc8be4d885ee0259e.json | Flush the application after each test. | src/Illuminate/Foundation/Application.php | @@ -1202,6 +1202,18 @@ public function registerCoreContainerAliases()
}
}
+ /**
+ * Flush the container of all bindings and resolved instances.
+ *
+ * @return void
+ */
+ public function flush()
+ {
+ parent::flush();
+
+ $this->loadedProviders = [];
+ }
+
/**
* Dynamically access application services.
* | true |
Other | laravel | framework | 7602d93ce35e8f0baf9915ebc8be4d885ee0259e.json | Flush the application after each test. | src/Illuminate/Foundation/Testing/TestCase.php | @@ -4,6 +4,15 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
use ApplicationTrait, AssertionsTrait;
+ /**
+ * Creates the application.
+ *
+ * Needs to be implemented by subclasses.
+ *
+ * @return \Symfony\Component\HttpKernel\HttpKernelInterface
+ */
+ abstract public function createApplication();
+
/**
* Setup the test environment.
*
@@ -18,12 +27,13 @@ public function setUp()
}
/**
- * Creates the application.
- *
- * Needs to be implemented by subclasses.
+ * Clean up the testing environment before the next test.
*
- * @return \Symfony\Component\HttpKernel\HttpKernelInterface
+ * @return void
*/
- abstract public function createApplication();
+ public function tearDown()
+ {
+ $this->app->flush();
+ }
} | true |
Other | laravel | framework | adcdb9abf287b7fdc418ef2b73daff367f654c11.json | Fix double semicolon. | src/Illuminate/Foundation/Providers/PublisherServiceProvider.php | @@ -125,7 +125,7 @@ protected function registerViewPublisher()
$this->app->bindShared('view.publisher', function($app)
{
- $viewPath = $app['path.base'].'/resources/views';;
+ $viewPath = $app['path.base'].'/resources/views';
// Once we have created the view publisher, we will set the default packages
// path on this object so that it knows where to find all of the packages | false |
Other | laravel | framework | 855bb1b07e1d0cd8e88115849baf4c5c02136a95.json | Fix path that doesn't exist. | src/Illuminate/Foundation/Providers/PublisherServiceProvider.php | @@ -125,7 +125,7 @@ protected function registerViewPublisher()
$this->app->bindShared('view.publisher', function($app)
{
- $viewPath = $app['path.views'];
+ $viewPath = $app['path'].'/resources/views';;
// Once we have created the view publisher, we will set the default packages
// path on this object so that it knows where to find all of the packages | false |
Other | laravel | framework | 7f29d869e3eda2046fc49f22d95c28bad041993d.json | Add messages() method stub
Add messages() method that returns empty array, when missing a
reflection exception is thrown Method
App\Http\Requests\RegistrationRequest::messages() does not exist | src/Illuminate/Foundation/Http/FormRequest.php | @@ -224,5 +224,15 @@ public function __get($key)
{
return $this->input($key);
}
+
+ /**
+ * Set custom messages for validator errors.
+ *
+ * @return array
+ */
+ public function messages()
+ {
+ return [];
+ }
} | false |
Other | laravel | framework | 26a13b52396860c695f05d826b044dea3b8d109c.json | Return queue calls. | src/Illuminate/Mail/Mailer.php | @@ -158,13 +158,13 @@ public function send($view, array $data, $callback)
* @param array $data
* @param \Closure|string $callback
* @param string $queue
- * @return void
+ * @return mixed
*/
public function queue($view, array $data, $callback, $queue = null)
{
$callback = $this->buildQueueCallable($callback);
- $this->queue->push('mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue);
+ return $this->queue->push('mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue);
}
/**
@@ -174,11 +174,11 @@ public function queue($view, array $data, $callback, $queue = null)
* @param string|array $view
* @param array $data
* @param \Closure|string $callback
- * @return void
+ * @return mixed
*/
public function queueOn($queue, $view, array $data, $callback)
{
- $this->queue($view, $data, $callback, $queue);
+ return $this->queue($view, $data, $callback, $queue);
}
/**
@@ -189,13 +189,13 @@ public function queueOn($queue, $view, array $data, $callback)
* @param array $data
* @param \Closure|string $callback
* @param string $queue
- * @return void
+ * @return mixed
*/
public function later($delay, $view, array $data, $callback, $queue = null)
{
$callback = $this->buildQueueCallable($callback);
- $this->queue->later($delay, 'mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue);
+ return $this->queue->later($delay, 'mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue);
}
/**
@@ -206,11 +206,11 @@ public function later($delay, $view, array $data, $callback, $queue = null)
* @param string|array $view
* @param array $data
* @param \Closure|string $callback
- * @return void
+ * @return mixed
*/
public function laterOn($queue, $delay, $view, array $data, $callback)
{
- $this->later($delay, $view, $data, $callback, $queue);
+ return $this->later($delay, $view, $data, $callback, $queue);
}
/** | false |
Other | laravel | framework | 252d3a534e2f318a6d4d3d70738a4ae300ade88b.json | Update the read me and contribution guide. | CONTRIBUTING.md | @@ -1,28 +1,3 @@
# Laravel Contribution Guide
-This page contains guidelines for contributing to the Laravel framework. Please review these guidelines before submitting any pull requests to the framework.
-
-## Which Branch?
-
-**ALL** bug fixes should be made to the 4.x branch which they belong. Bug fixes should never be sent to the `master` branch unless they fix features that exist only in the upcoming release.
-
-## Pull Requests
-
-The pull request process differs for new features and bugs. Before sending a pull request for a new feature, you should first create an issue with `[Proposal]` in the title. The proposal should describe the new feature, as well as implementation ideas. The proposal will then be reviewed and either approved or denied. Once a proposal is approved, a pull request may be created implementing the new feature. Pull requests which do not follow this guideline will be closed immediately.
-
-Pull requests for bugs may be sent without creating any proposal issue. If you believe that you know of a solution for a bug that has been filed on GitHub, please leave a comment detailing your proposed fix.
-
-You should ensure that the current tests pass, and if you've added something new, add the tests where relevant. Please send a coherent commit history, making sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
-
-### Feature Requests
-
-If you have an idea for a new feature you would like to see added to Laravel, you may create an issue on GitHub with `[Request]` in the title. The feature request will then be reviewed by [@taylorotwell](https://github.com/taylorotwell).
-
-## Coding Guidelines
-
-Laravel follows the [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) and [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) coding standards. In addition to these standards, below is a list of other coding standards that should be followed:
-
-- Namespace declarations should be on the same line as `<?php`.
-- Class opening `{` should be on the same line as the class name.
-- Function and control structure opening `{` should be on a separate line.
-- Interface and Trait names are suffixed with `Interface` (`FooInterface`) and `Trait` (`FooTrait`) respectively.
+Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions). Please review the entire guide before sending a pull request. | true |
Other | laravel | framework | 252d3a534e2f318a6d4d3d70738a4ae300ade88b.json | Update the read me and contribution guide. | readme.md | @@ -10,19 +10,17 @@
## Laravel PHP Framework
-Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching.
-
-Laravel aims to make the development process a pleasing one for the developer without sacrificing application functionality. Happy developers make the best code. To this end, we've attempted to combine the very best of what we have seen in other web frameworks, including frameworks implemented in other languages, such as Ruby on Rails, ASP.NET MVC, and Sinatra.
+Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, queueing, and caching.
Laravel is accessible, yet powerful, providing powerful tools needed for large, robust applications. A superb inversion of control container, expressive migration system, and tightly integrated unit testing support give you the tools you need to build any application with which you are tasked.
## Official Documentation
-Documentation for the entire framework can be found on the [Laravel website](http://laravel.com/docs).
+Documentation for the framework can be found on the [Laravel website](http://laravel.com/docs).
## Contributing
-Thank you for considering contributing to the Laravel framework. If you are submitting a bug-fix, or an enhancement that is **not** a breaking change, submit your pull request to the branch corresponding to the latest stable release of the framework, such as the `4.2` branch. If you are submitting a breaking change or an entirely new component, submit your pull request to the `master` branch.
+Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions).
### License
| true |
Other | laravel | framework | 86e0a082eb43beb93d8677742c3b3b4fe42bc338.json | Allow Custom Messages
Custom Messages for FormRequest Validation | src/Illuminate/Foundation/Http/FormRequest.php | @@ -63,7 +63,7 @@ class FormRequest extends Request {
public function validate(ValidationFactory $factory)
{
$instance = $factory->make(
- $this->input(), $this->container->call([$this, 'rules'])
+ $this->input(), $this->container->call([$this, 'rules']), $this->container->call([$this, 'messages'])
);
if ($instance->fails()) | false |
Other | laravel | framework | b257d849d0010c9c6571a4b7c62be948470c95d8.json | Add method to contract. | src/Illuminate/Contracts/Events/Dispatcher.php | @@ -39,6 +39,13 @@ public function until($event, $payload = array());
*/
public function fire($event, $payload = array(), $halt = false);
+ /**
+ * Get the event that is currently firing.
+ *
+ * @return string
+ */
+ public function firing();
+
/**
* Remove a set of listeners from the dispatcher.
* | false |
Other | laravel | framework | 41e76aed563c83a633c1187b1768e2181c213a28.json | Add missing space | src/Illuminate/Support/SerializableClosure.php | @@ -50,7 +50,7 @@ public function getVariables()
*/
protected function determineCodeAndVariables()
{
- if (!$this->code)
+ if ( ! $this->code)
{
list($this->code, $this->variables) = unserialize($this->serialize());
} | false |
Other | laravel | framework | 30001aa8f5ac79dfdb27270f8bc82e8c37d7e0b1.json | Move transport registration to separate class
By moving this functionality outside of the service provider and into a class that extends the Manager class, we offer an easier way to user to register their own mail drivers. | src/Illuminate/Mail/MailServiceProvider.php | @@ -2,12 +2,6 @@
use Swift_Mailer;
use Illuminate\Support\ServiceProvider;
-use Swift_SmtpTransport as SmtpTransport;
-use Swift_MailTransport as MailTransport;
-use Illuminate\Mail\Transport\LogTransport;
-use Illuminate\Mail\Transport\MailgunTransport;
-use Illuminate\Mail\Transport\MandrillTransport;
-use Swift_SendmailTransport as SendmailTransport;
class MailServiceProvider extends ServiceProvider {
@@ -90,161 +84,27 @@ protected function setMailerDependencies($mailer, $app)
*/
public function registerSwiftMailer()
{
- $config = $this->app['config']['mail'];
-
- $this->registerSwiftTransport($config);
+ $this->registerSwiftTransport();
// Once we have the transporter registered, we will register the actual Swift
// mailer instance, passing in the transport instances, which allows us to
// override this transporter instances during app start-up if necessary.
$this->app['swift.mailer'] = $this->app->share(function($app)
{
- return new Swift_Mailer($app['swift.transport']);
+ return new Swift_Mailer($app['swift.transport']->driver());
});
}
/**
* Register the Swift Transport instance.
*
- * @param array $config
- * @return void
- *
- * @throws \InvalidArgumentException
- */
- protected function registerSwiftTransport($config)
- {
- switch ($config['driver'])
- {
- case 'smtp':
- return $this->registerSmtpTransport($config);
-
- case 'sendmail':
- return $this->registerSendmailTransport($config);
-
- case 'mail':
- return $this->registerMailTransport($config);
-
- case 'mailgun':
- return $this->registerMailgunTransport($config);
-
- case 'mandrill':
- return $this->registerMandrillTransport($config);
-
- case 'log':
- return $this->registerLogTransport($config);
-
- default:
- throw new \InvalidArgumentException('Invalid mail driver.');
- }
- }
-
- /**
- * Register the SMTP Swift Transport instance.
- *
- * @param array $config
- * @return void
- */
- protected function registerSmtpTransport($config)
- {
- $this->app['swift.transport'] = $this->app->share(function() use ($config)
- {
- extract($config);
-
- // The Swift SMTP transport instance will allow us to use any SMTP backend
- // for delivering mail such as Sendgrid, Amazon SES, or a custom server
- // a developer has available. We will just pass this configured host.
- $transport = SmtpTransport::newInstance($host, $port);
-
- if (isset($encryption))
- {
- $transport->setEncryption($encryption);
- }
-
- // Once we have the transport we will check for the presence of a username
- // and password. If we have it we will set the credentials on the Swift
- // transporter instance so that we'll properly authenticate delivery.
- if (isset($username))
- {
- $transport->setUsername($username);
-
- $transport->setPassword($password);
- }
-
- return $transport;
- });
- }
-
- /**
- * Register the Sendmail Swift Transport instance.
- *
- * @param array $config
- * @return void
- */
- protected function registerSendmailTransport($config)
- {
- $this->app['swift.transport'] = $this->app->share(function() use ($config)
- {
- return SendmailTransport::newInstance($config['sendmail']);
- });
- }
-
- /**
- * Register the Mail Swift Transport instance.
- *
- * @param array $config
- * @return void
- */
- protected function registerMailTransport($config)
- {
- $this->app['swift.transport'] = $this->app->share(function()
- {
- return MailTransport::newInstance();
- });
- }
-
- /**
- * Register the Mailgun Swift Transport instance.
- *
- * @param array $config
- * @return void
- */
- protected function registerMailgunTransport($config)
- {
- $mailgun = $this->app['config']->get('services.mailgun', array());
-
- $this->app->bindShared('swift.transport', function() use ($mailgun)
- {
- return new MailgunTransport($mailgun['secret'], $mailgun['domain']);
- });
- }
-
- /**
- * Register the Mandrill Swift Transport instance.
- *
- * @param array $config
- * @return void
- */
- protected function registerMandrillTransport($config)
- {
- $mandrill = $this->app['config']->get('services.mandrill', array());
-
- $this->app->bindShared('swift.transport', function() use ($mandrill)
- {
- return new MandrillTransport($mandrill['secret']);
- });
- }
-
- /**
- * Register the "Log" Swift Transport instance.
- *
- * @param array $config
* @return void
*/
- protected function registerLogTransport($config)
+ protected function registerSwiftTransport()
{
- $this->app->bindShared('swift.transport', function($app)
+ $this->app['swift.transport'] = $this->app->share(function($app)
{
- return new LogTransport($app['log']->getMonolog());
+ return new TransportManager($app);
});
}
| true |
Other | laravel | framework | 30001aa8f5ac79dfdb27270f8bc82e8c37d7e0b1.json | Move transport registration to separate class
By moving this functionality outside of the service provider and into a class that extends the Manager class, we offer an easier way to user to register their own mail drivers. | src/Illuminate/Mail/TransportManager.php | @@ -0,0 +1,122 @@
+<?php namespace Illuminate\Mail;
+
+use Illuminate\Support\Manager;
+use Swift_SmtpTransport as SmtpTransport;
+use Swift_MailTransport as MailTransport;
+use Illuminate\Mail\Transport\LogTransport;
+use Illuminate\Mail\Transport\MailgunTransport;
+use Illuminate\Mail\Transport\MandrillTransport;
+use Swift_SendmailTransport as SendmailTransport;
+
+class TransportManager extends Manager {
+
+ /**
+ * Create an instance of the SMTP Swift Transport driver.
+ *
+ * @return \Swift_SmtpTransport
+ */
+ protected function createSmtpDriver()
+ {
+ $config = $this->app['config']['mail'];
+
+ // The Swift SMTP transport instance will allow us to use any SMTP backend
+ // for delivering mail such as Sendgrid, Amazon SES, or a custom server
+ // a developer has available. We will just pass this configured host.
+ $transport = SmtpTransport::newInstance($config['host'], $config['port']);
+
+ if (isset($config['encryption']))
+ {
+ $transport->setEncryption($config['encryption']);
+ }
+
+ // Once we have the transport we will check for the presence of a username
+ // and password. If we have it we will set the credentials on the Swift
+ // transporter instance so that we'll properly authenticate delivery.
+ if (isset($config['username']))
+ {
+ $transport->setUsername($config['username']);
+
+ $transport->setPassword($config['password']);
+ }
+
+ return $transport;
+ }
+
+ /**
+ * Create an instance of the Sendmail Swift Transport driver.
+ *
+ * @return \Swift_SendmailTransport
+ */
+ protected function createSendmailDriver()
+ {
+ $command = $this->app['config']['mail']['sendmail'];
+
+ return SendmailTransport::newInstance($command);
+ }
+
+ /**
+ * Create an instance of the Mail Swift Transport driver.
+ *
+ * @return \Swift_MailTransport
+ */
+ protected function createMailDriver()
+ {
+ return MailTransport::newInstance();
+ }
+
+ /**
+ * Create an instance of the Mailgun Swift Transport driver.
+ *
+ * @return \Illuminate\Mail\Transport\MailgunTransport
+ */
+ protected function createMailgunDriver()
+ {
+ $config = $this->app['config']->get('services.mailgun', array());
+
+ return new MailgunTransport($config['secret'], $config['domain']);
+ }
+
+ /**
+ * Create an instance of the Mandrill Swift Transport driver.
+ *
+ * @return \Illuminate\Mail\Transport\MandrillTransport
+ */
+ protected function createMandrillDriver()
+ {
+ $config = $this->app['config']->get('services.mandrill', array());
+
+ return new MandrillTransport($config['secret']);
+ }
+
+ /**
+ * Create an instance of the Log Swift Transport driver.
+ *
+ * @return \Illuminate\Mail\Transport\LogTransport
+ */
+ protected function createLogDriver()
+ {
+ return new LogTransport($this->app['log']->getMonolog());
+ }
+
+ /**
+ * Get the default cache driver name.
+ *
+ * @return string
+ */
+ public function getDefaultDriver()
+ {
+ return $this->app['config']['mail.driver'];
+ }
+
+ /**
+ * Set the default cache driver name.
+ *
+ * @param string $name
+ * @return void
+ */
+ public function setDefaultDriver($name)
+ {
+ $this->app['config']['mail.driver'] = $name;
+ }
+
+} | true |
Other | laravel | framework | 48e5698fe4c4a669f609c2b9ba22886a33c0fd89.json | Remove unused import statement | src/Illuminate/Mail/Mailer.php | @@ -3,7 +3,6 @@
use Closure;
use Swift_Mailer;
use Swift_Message;
-use Illuminate\Log\Writer;
use Psr\Log\LoggerInterface;
use Illuminate\Container\Container;
use Illuminate\Contracts\View\Factory; | false |
Other | laravel | framework | 9a2ebbbc2ccf6b2f91db2cea0271d58c38642fd4.json | Change a doc block. | src/Illuminate/Support/ServiceProvider.php | @@ -7,7 +7,7 @@ abstract class ServiceProvider {
/**
* The application instance.
*
- * @var \Illuminate\Foundation\Application
+ * @var \Illuminate\Contracts\Foundation\Application
*/
protected $app;
@@ -21,7 +21,7 @@ abstract class ServiceProvider {
/**
* Create a new service provider instance.
*
- * @param \Illuminate\Foundation\Application $app
+ * @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
public function __construct($app) | false |
Other | laravel | framework | 50578255e967c24c34fc02d49f07fa8012ccdf0a.json | Extend the container interface from app. | src/Illuminate/Contracts/Foundation/Application.php | @@ -1,6 +1,8 @@
<?php namespace Illuminate\Contracts\Foundation;
-interface Application {
+use Illuminate\Contracts\Container\Container;
+
+interface Application extends Container {
/**
* Register a service provider with the application. | false |
Other | laravel | framework | c79c1ed4ff05f30e6e882473c8dc11f99422a4a4.json | Add a basic application contract. | src/Illuminate/Contracts/Foundation/Application.php | @@ -0,0 +1,47 @@
+<?php namespace Illuminate\Contracts\Foundation;
+
+interface Application {
+
+ /**
+ * Register a service provider with the application.
+ *
+ * @param \Illuminate\Support\ServiceProvider|string $provider
+ * @param array $options
+ * @param bool $force
+ * @return \Illuminate\Support\ServiceProvider
+ */
+ public function register($provider, $options = array(), $force = false);
+
+ /**
+ * Register a deferred provider and service.
+ *
+ * @param string $provider
+ * @param string $service
+ * @return void
+ */
+ public function registerDeferredProvider($provider, $service = null);
+
+ /**
+ * Boot the application's service providers.
+ *
+ * @return void
+ */
+ public function boot();
+
+ /**
+ * Register a new boot listener.
+ *
+ * @param mixed $callback
+ * @return void
+ */
+ public function booting($callback);
+
+ /**
+ * Register a new "booted" listener.
+ *
+ * @param mixed $callback
+ * @return void
+ */
+ public function booted($callback);
+
+} | true |
Other | laravel | framework | c79c1ed4ff05f30e6e882473c8dc11f99422a4a4.json | Add a basic application contract. | src/Illuminate/Foundation/Application.php | @@ -20,8 +20,12 @@
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+use Illuminate\Contracts\Foundation\Application as ApplicationContract;
-class Application extends Container implements HttpKernelInterface, TerminableInterface, ResponsePreparerInterface {
+class Application extends Container implements HttpKernelInterface,
+ TerminableInterface,
+ ApplicationContract,
+ ResponsePreparerInterface {
/**
* The Laravel framework version. | true |
Other | laravel | framework | 4d6737d59ad4d5dd532a77c46749c34b624b8e50.json | Remove useless $app argument | src/Illuminate/Auth/GeneratorServiceProvider.php | @@ -72,7 +72,7 @@ protected function registerAuthControllerCommand()
*/
protected function registerAuthMakeCommand()
{
- $this->app->bindShared('command.auth.make', function($app)
+ $this->app->bindShared('command.auth.make', function()
{
return new AuthMakeCommand;
});
@@ -85,7 +85,7 @@ protected function registerAuthMakeCommand()
*/
protected function registerClearRemindersCommand()
{
- $this->app->bindShared('command.auth.reminders.clear', function($app)
+ $this->app->bindShared('command.auth.reminders.clear', function()
{
return new ClearRemindersCommand;
}); | true |
Other | laravel | framework | 4d6737d59ad4d5dd532a77c46749c34b624b8e50.json | Remove useless $app argument | src/Illuminate/Database/MigrationServiceProvider.php | @@ -145,7 +145,7 @@ protected function registerResetCommand()
*/
protected function registerRefreshCommand()
{
- $this->app->bindShared('command.migrate.refresh', function($app)
+ $this->app->bindShared('command.migrate.refresh', function()
{
return new RefreshCommand;
});
| true |
Other | laravel | framework | 4d6737d59ad4d5dd532a77c46749c34b624b8e50.json | Remove useless $app argument | src/Illuminate/Database/SeedServiceProvider.php | @@ -21,7 +21,7 @@ public function register()
{
$this->registerSeedCommand();
- $this->app->bindShared('seeder', function($app)
+ $this->app->bindShared('seeder', function()
{
return new Seeder;
});
| true |
Other | laravel | framework | 4d6737d59ad4d5dd532a77c46749c34b624b8e50.json | Remove useless $app argument | src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php | @@ -155,7 +155,7 @@ protected function registerDownCommand()
*/
protected function registerEnvironmentCommand()
{
- $this->app->bindShared('command.environment', function($app)
+ $this->app->bindShared('command.environment', function()
{
return new EnvironmentCommand;
}); | true |
Other | laravel | framework | 4d6737d59ad4d5dd532a77c46749c34b624b8e50.json | Remove useless $app argument | src/Illuminate/Foundation/Providers/PublisherServiceProvider.php | @@ -173,7 +173,7 @@ protected function registerMigrationPublisher()
*/
protected function registerMigratePublishCommand()
{
- $this->app->bindShared('command.migrate.publish', function($app)
+ $this->app->bindShared('command.migrate.publish', function()
{
return new MigratePublishCommand;
}); | true |
Other | laravel | framework | 4d6737d59ad4d5dd532a77c46749c34b624b8e50.json | Remove useless $app argument | src/Illuminate/Mail/MailServiceProvider.php | @@ -146,7 +146,7 @@ protected function registerSwiftTransport($config)
*/
protected function registerSmtpTransport($config)
{
- $this->app['swift.transport'] = $this->app->share(function($app) use ($config)
+ $this->app['swift.transport'] = $this->app->share(function() use ($config)
{
extract($config);
@@ -182,7 +182,7 @@ protected function registerSmtpTransport($config)
*/
protected function registerSendmailTransport($config)
{
- $this->app['swift.transport'] = $this->app->share(function($app) use ($config)
+ $this->app['swift.transport'] = $this->app->share(function() use ($config)
{
return SendmailTransport::newInstance($config['sendmail']);
});
| true |
Other | laravel | framework | 4d6737d59ad4d5dd532a77c46749c34b624b8e50.json | Remove useless $app argument | src/Illuminate/Queue/FailConsoleServiceProvider.php | @@ -23,22 +23,22 @@ class FailConsoleServiceProvider extends ServiceProvider {
*/
public function register()
{
- $this->app->bindShared('command.queue.failed', function($app)
+ $this->app->bindShared('command.queue.failed', function()
{
return new ListFailedCommand;
});
- $this->app->bindShared('command.queue.retry', function($app)
+ $this->app->bindShared('command.queue.retry', function()
{
return new RetryCommand;
});
- $this->app->bindShared('command.queue.forget', function($app)
+ $this->app->bindShared('command.queue.forget', function()
{
return new ForgetFailedCommand;
});
- $this->app->bindShared('command.queue.flush', function($app)
+ $this->app->bindShared('command.queue.flush', function()
{
return new FlushFailedCommand;
}); | true |
Other | laravel | framework | 4d6737d59ad4d5dd532a77c46749c34b624b8e50.json | Remove useless $app argument | src/Illuminate/Queue/QueueServiceProvider.php | @@ -136,7 +136,7 @@ protected function registerListenCommand()
*/
public function registerRestartCommand()
{
- $this->app->bindShared('command.queue.restart', function($app)
+ $this->app->bindShared('command.queue.restart', function()
{
return new RestartCommand;
});
@@ -151,7 +151,7 @@ public function registerRestartCommand()
*/
protected function registerSubscriber()
{
- $this->app->bindShared('command.queue.subscribe', function($app)
+ $this->app->bindShared('command.queue.subscribe', function()
{
return new SubscribeCommand;
});
| true |
Other | laravel | framework | 4d6737d59ad4d5dd532a77c46749c34b624b8e50.json | Remove useless $app argument | src/Illuminate/View/ViewServiceProvider.php | @@ -35,7 +35,7 @@ public function register()
*/
public function registerEngineResolver()
{
- $this->app->bindShared('view.engine.resolver', function($app)
+ $this->app->bindShared('view.engine.resolver', function()
{
$resolver = new EngineResolver;
| true |
Other | laravel | framework | c4a5b3b0967820eacdcc1d351d48f1e1afa07ec9.json | Fix migration path. | src/Illuminate/Database/Console/Migrations/BaseCommand.php | @@ -43,7 +43,7 @@ protected function getMigrationPath()
return $this->laravel['path.base'].$path;
}
- return $this->laravel['path'].'/database/migrations';
+ return $this->laravel['path.database'].'/migrations';
}
} | true |
Other | laravel | framework | c4a5b3b0967820eacdcc1d351d48f1e1afa07ec9.json | Fix migration path. | tests/Database/DatabaseMigrationMigrateCommandTest.php | @@ -14,10 +14,10 @@ public function tearDown()
public function testBasicMigrationsCallMigratorWithProperArguments()
{
$command = new MigrateCommand($migrator = m::mock('Illuminate\Database\Migrations\Migrator'), __DIR__.'/vendor');
- $app = new ApplicationDatabaseMigrationStub(array('path' => __DIR__));
+ $app = new ApplicationDatabaseMigrationStub(array('path.database' => __DIR__));
$command->setLaravel($app);
$migrator->shouldReceive('setConnection')->once()->with(null);
- $migrator->shouldReceive('run')->once()->with(__DIR__.'/database/migrations', false);
+ $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false);
$migrator->shouldReceive('getNotes')->andReturn(array());
$migrator->shouldReceive('repositoryExists')->once()->andReturn(true);
@@ -29,10 +29,10 @@ public function testMigrationRepositoryCreatedWhenNecessary()
{
$params = array($migrator = m::mock('Illuminate\Database\Migrations\Migrator'), __DIR__.'/vendor');
$command = $this->getMock('Illuminate\Database\Console\Migrations\MigrateCommand', array('call'), $params);
- $app = new ApplicationDatabaseMigrationStub(array('path' => __DIR__));
+ $app = new ApplicationDatabaseMigrationStub(array('path.database' => __DIR__));
$command->setLaravel($app);
$migrator->shouldReceive('setConnection')->once()->with(null);
- $migrator->shouldReceive('run')->once()->with(__DIR__.'/database/migrations', false);
+ $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false);
$migrator->shouldReceive('getNotes')->andReturn(array());
$migrator->shouldReceive('repositoryExists')->once()->andReturn(false);
$command->expects($this->once())->method('call')->with($this->equalTo('migrate:install'), $this->equalTo(array('--database' => null)));
@@ -70,10 +70,10 @@ public function testVendorPackageIsRespectedWhenMigrating()
public function testTheCommandMayBePretended()
{
$command = new MigrateCommand($migrator = m::mock('Illuminate\Database\Migrations\Migrator'), __DIR__.'/vendor');
- $app = new ApplicationDatabaseMigrationStub(array('path' => __DIR__));
+ $app = new ApplicationDatabaseMigrationStub(array('path.database' => __DIR__));
$command->setLaravel($app);
$migrator->shouldReceive('setConnection')->once()->with(null);
- $migrator->shouldReceive('run')->once()->with(__DIR__.'/database/migrations', true);
+ $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', true);
$migrator->shouldReceive('getNotes')->andReturn(array());
$migrator->shouldReceive('repositoryExists')->once()->andReturn(true);
@@ -84,10 +84,10 @@ public function testTheCommandMayBePretended()
public function testTheDatabaseMayBeSet()
{
$command = new MigrateCommand($migrator = m::mock('Illuminate\Database\Migrations\Migrator'), __DIR__.'/vendor');
- $app = new ApplicationDatabaseMigrationStub(array('path' => __DIR__));
+ $app = new ApplicationDatabaseMigrationStub(array('path.database' => __DIR__));
$command->setLaravel($app);
$migrator->shouldReceive('setConnection')->once()->with('foo');
- $migrator->shouldReceive('run')->once()->with(__DIR__.'/database/migrations', false);
+ $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false);
$migrator->shouldReceive('getNotes')->andReturn(array());
$migrator->shouldReceive('repositoryExists')->once()->andReturn(true);
| true |
Other | laravel | framework | ebcdae3af3afb5d39e9fe57764a97da275e8cda6.json | Remove social interfaces. | src/Illuminate/Contracts/Auth/Social/Factory.php | @@ -1,13 +0,0 @@
-<?php namespace Illuminate\Contracts\Auth\Social;
-
-interface Factory {
-
- /**
- * Get an OAuth provider implementation.
- *
- * @param string $driver
- * @return \Illuminate\Contracts\Auth\Social\Provider
- */
- public function driver($driver = null);
-
-} | true |
Other | laravel | framework | ebcdae3af3afb5d39e9fe57764a97da275e8cda6.json | Remove social interfaces. | src/Illuminate/Contracts/Auth/Social/Provider.php | @@ -1,19 +0,0 @@
-<?php namespace Illuminate\Contracts\Auth\Social;
-
-interface Provider {
-
- /**
- * Redirect the user to the authentication page for the provider.
- *
- * @return \Symfony\Component\HttpFoundation\RedirectResponse
- */
- public function redirect();
-
- /**
- * Get the User instance for the authenticated user.
- *
- * @return \Illuminate\Contracts\Auth\Social\User
- */
- public function user();
-
-} | true |
Other | laravel | framework | ebcdae3af3afb5d39e9fe57764a97da275e8cda6.json | Remove social interfaces. | src/Illuminate/Contracts/Auth/Social/User.php | @@ -1,40 +0,0 @@
-<?php namespace Illuminate\Contracts\Auth\Social;
-
-interface User {
-
- /**
- * Get the unique identifier for the user.
- *
- * @return string
- */
- public function getId();
-
- /**
- * Get the nickname / username for the user.
- *
- * @return string
- */
- public function getNickname();
-
- /**
- * Get the full name of the user.
- *
- * @return string
- */
- public function getName();
-
- /**
- * Get the e-mail address of the user.
- *
- * @return string
- */
- public function getEmail();
-
- /**
- * Get the avatar / image URL for the user.
- *
- * @return string
- */
- public function getAvatar();
-
-}
\ No newline at end of file | true |
Other | laravel | framework | e9cf10be548d6e233416a634e79478859e23168b.json | Fix doc block. | src/Illuminate/Contracts/Filesystem/Factory.php | @@ -3,7 +3,7 @@
interface Factory {
/**
- * Get an OAuth provider implementation.
+ * Get a filesystem implementation.
*
* @param string $name
* @return \Illuminate\Contracts\Filesystem\Filesystem | false |
Other | laravel | framework | 8056d41b148dfca2d2f73a5c325e8fc91ecff3c5.json | Run provider boot method through Container call. | src/Illuminate/Foundation/Application.php | @@ -7,6 +7,7 @@
use Illuminate\Container\Container;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Facade;
+use Illuminate\Support\ServiceProvider;
use Illuminate\Events\EventServiceProvider;
use Illuminate\Routing\RoutingServiceProvider;
use Illuminate\Exception\ExceptionServiceProvider;
@@ -330,7 +331,10 @@ public function register($provider, $options = array(), $force = false)
// If the application has already booted, we will call this boot method on
// the provider class so it has an opportunity to do its boot logic and
// will be ready for any usage by the developer's application logics.
- if ($this->booted) $provider->boot();
+ if ($this->booted)
+ {
+ $this->bootProvider($provider);
+ }
return $provider;
}
@@ -437,7 +441,7 @@ public function registerDeferredProvider($provider, $service = null)
{
$this->booting(function() use ($instance)
{
- $instance->boot();
+ $this->bootProvider($instance);
});
}
}
@@ -583,7 +587,7 @@ public function boot()
{
if ($this->booted) return;
- array_walk($this->serviceProviders, function($p) { $p->boot(); });
+ array_walk($this->serviceProviders, function($p) { $this->bootProvider($p); });
$this->bootApplication();
}
@@ -629,6 +633,17 @@ public function booted($callback)
if ($this->isBooted()) $this->fireAppCallbacks(array($callback));
}
+ /**
+ * Boot the given service provider.
+ *
+ * @param \Illuminate\Support\ServiceProvider $provider
+ * @return void
+ */
+ protected function bootProvider(ServiceProvider $provider)
+ {
+ return $this->call([$provider, 'boot']);
+ }
+
/**
* Run the application and send the response.
* | false |
Other | laravel | framework | 3082830437b427386870c3c52a74886646de7b26.json | Add logger contract. | src/Illuminate/Contracts/Logging/Logger.php | @@ -0,0 +1,96 @@
+<?php namespace Illuminate\Contracts\Logging;
+
+interface Logger {
+
+ /**
+ * Log an alert message to the logs.
+ *
+ * @param string $message
+ * @param array $context
+ * @return void
+ */
+ public function alert($message, array $context = array());
+
+ /**
+ * Log a critical message to the logs.
+ *
+ * @param string $message
+ * @param array $context
+ * @return void
+ */
+ public function critical($message, array $context = array());
+
+ /**
+ * Log an error message to the logs.
+ *
+ * @param string $message
+ * @param array $context
+ * @return void
+ */
+ public function error($message, array $context = array());
+
+ /**
+ * Log a warning message to the logs.
+ *
+ * @param string $message
+ * @param array $context
+ * @return void
+ */
+ public function warning($message, array $context = array());
+
+ /**
+ * Log a notice to the logs.
+ *
+ * @param string $message
+ * @param array $context
+ * @return void
+ */
+ public function notice($message, array $context = array());
+
+ /**
+ * Log an informational message to the logs.
+ *
+ * @param string $message
+ * @param array $context
+ * @return void
+ */
+ public function info($message, array $context = array());
+
+ /**
+ * Log a debug message to the logs.
+ *
+ * @param string $message
+ * @param array $context
+ * @return void
+ */
+ public function debug($message, array $context = array());
+
+ /**
+ * Log a message to the logs.
+ *
+ * @param string $message
+ * @param array $context
+ * @return void
+ */
+ public function log($level, $message, array $context = array());
+
+ /**
+ * Register a file log handler.
+ *
+ * @param string $path
+ * @param string $level
+ * @return void
+ */
+ public function useFiles($path, $level = 'debug');
+
+ /**
+ * Register a daily file log handler.
+ *
+ * @param string $path
+ * @param int $days
+ * @param string $level
+ * @return void
+ */
+ public function useDailyFiles($path, $days = 0, $level = 'debug');
+
+} | true |
Other | laravel | framework | 3082830437b427386870c3c52a74886646de7b26.json | Add logger contract. | src/Illuminate/Log/Writer.php | @@ -9,8 +9,9 @@
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Support\JsonableInterface;
use Illuminate\Contracts\Support\ArrayableInterface;
+use Illuminate\Contracts\Logging\Logger as LoggerContract;
-class Writer {
+class Writer implements LoggerContract {
/**
* The Monolog logger instance.
@@ -60,120 +61,174 @@ public function __construct(MonologLogger $monolog, Dispatcher $dispatcher = nul
}
/**
- * Call Monolog with the given method and parameters.
+ * Log an alert message to the logs.
*
- * @param string $method
- * @param mixed $parameters
- * @return mixed
+ * @param string $message
+ * @param array $context
+ * @return void
*/
- protected function callMonolog($method, $parameters)
+ public function alert($message, array $context = array())
{
- if (is_array($parameters[0]))
- {
- $parameters[0] = json_encode($parameters[0]);
- }
-
- return call_user_func_array(array($this->monolog, $method), $parameters);
+ return $this->writeLog(__FUNCTION__, $message, $context);
}
/**
- * Register a file log handler.
+ * Log a critical message to the logs.
*
- * @param string $path
- * @param string $level
+ * @param string $message
+ * @param array $context
* @return void
*/
- public function useFiles($path, $level = 'debug')
+ public function critical($message, array $context = array())
{
- $level = $this->parseLevel($level);
-
- $this->monolog->pushHandler($handler = new StreamHandler($path, $level));
-
- $handler->setFormatter($this->getDefaultFormatter());
+ return $this->writeLog(__FUNCTION__, $message, $context);
}
/**
- * Register a daily file log handler.
+ * Log an error message to the logs.
*
- * @param string $path
- * @param int $days
- * @param string $level
+ * @param string $message
+ * @param array $context
* @return void
*/
- public function useDailyFiles($path, $days = 0, $level = 'debug')
+ public function error($message, array $context = array())
{
- $level = $this->parseLevel($level);
-
- $this->monolog->pushHandler($handler = new RotatingFileHandler($path, $days, $level));
+ return $this->writeLog(__FUNCTION__, $message, $context);
+ }
- $handler->setFormatter($this->getDefaultFormatter());
+ /**
+ * Log a warning message to the logs.
+ *
+ * @param string $message
+ * @param array $context
+ * @return void
+ */
+ public function warning($message, array $context = array())
+ {
+ return $this->writeLog(__FUNCTION__, $message, $context);
}
/**
- * Register an error_log handler.
+ * Log a notice to the logs.
*
- * @param string $level
- * @param integer $messageType
+ * @param string $message
+ * @param array $context
* @return void
*/
- public function useErrorLog($level = 'debug', $messageType = ErrorLogHandler::OPERATING_SYSTEM)
+ public function notice($message, array $context = array())
{
- $level = $this->parseLevel($level);
+ return $this->writeLog(__FUNCTION__, $message, $context);
+ }
- $this->monolog->pushHandler($handler = new ErrorLogHandler($messageType, $level));
+ /**
+ * Log an informational message to the logs.
+ *
+ * @param string $message
+ * @param array $context
+ * @return void
+ */
+ public function info($message, array $context = array())
+ {
+ return $this->writeLog(__FUNCTION__, $message, $context);
+ }
- $handler->setFormatter($this->getDefaultFormatter());
+ /**
+ * Log a debug message to the logs.
+ *
+ * @param string $message
+ * @param array $context
+ * @return void
+ */
+ public function debug($message, array $context = array())
+ {
+ return $this->writeLog(__FUNCTION__, $message, $context);
}
/**
- * Get a defaut Monolog formatter instance.
+ * Log a message to the logs.
*
- * @return \Monolog\Formatter\LineFormatter
+ * @param string $message
+ * @param array $context
+ * @return void
*/
- protected function getDefaultFormatter()
+ public function log($level, $message, array $context = array())
{
- return new LineFormatter(null, null, true);
+ return $this->writeLog($level, $message, $context);
}
/**
- * Parse the string level into a Monolog constant.
+ * Dynamically pass log calls into the writer.
*
* @param string $level
- * @return int
- *
- * @throws \InvalidArgumentException
+ * @param string $message
+ * @param array $context
+ * @return void
*/
- protected function parseLevel($level)
+ public function write($level, $message, array $context = array())
{
- switch ($level)
- {
- case 'debug':
- return MonologLogger::DEBUG;
+ return $this->log($level, $message, $context);
+ }
- case 'info':
- return MonologLogger::INFO;
+ /**
+ * Write a message to Monolog.
+ *
+ * @param string $level
+ * @param string $message
+ * @param array $context
+ * @return void
+ */
+ protected function writeLog($level, $message, $context)
+ {
+ $this->fireLogEvent($level, $message = $this->formatMessage($message), $context);
- case 'notice':
- return MonologLogger::NOTICE;
+ $this->monolog->{$level}($message, $context);
+ }
- case 'warning':
- return MonologLogger::WARNING;
+ /**
+ * Register a file log handler.
+ *
+ * @param string $path
+ * @param string $level
+ * @return void
+ */
+ public function useFiles($path, $level = 'debug')
+ {
+ $this->monolog->pushHandler($handler = new StreamHandler($path, $this->parseLevel($level)));
- case 'error':
- return MonologLogger::ERROR;
+ $handler->setFormatter($this->getDefaultFormatter());
+ }
- case 'critical':
- return MonologLogger::CRITICAL;
+ /**
+ * Register a daily file log handler.
+ *
+ * @param string $path
+ * @param int $days
+ * @param string $level
+ * @return void
+ */
+ public function useDailyFiles($path, $days = 0, $level = 'debug')
+ {
+ $this->monolog->pushHandler(
+ $handler = new RotatingFileHandler($path, $days, $this->parseLevel($level))
+ );
- case 'alert':
- return MonologLogger::ALERT;
+ $handler->setFormatter($this->getDefaultFormatter());
+ }
- case 'emergency':
- return MonologLogger::EMERGENCY;
+ /**
+ * Register an error_log handler.
+ *
+ * @param string $level
+ * @param integer $messageType
+ * @return void
+ */
+ public function useErrorLog($level = 'debug', $messageType = ErrorLogHandler::OPERATING_SYSTEM)
+ {
+ $this->monolog->pushHandler(
+ $handler = new ErrorLogHandler($messageType, $this->parseLevel($level))
+ );
- default:
- throw new \InvalidArgumentException("Invalid log level.");
- }
+ $handler->setFormatter($this->getDefaultFormatter());
}
/**
@@ -215,40 +270,67 @@ protected function fireLogEvent($level, $message, array $context = array())
}
/**
- * Dynamically pass log calls into the writer.
+ * Format the parameters for the logger.
*
- * @param mixed (level, param, param)
- * @return mixed
+ * @param mixed $parameters
+ * @return void
*/
- public function write()
+ protected function formatMessage($message)
{
- $level = head(func_get_args());
+ if (is_array($message))
+ {
+ return var_export($message, true);
+ }
+ elseif ($message instanceof JsonableInterface)
+ {
+ return $message->toJson();
+ }
+ elseif ($message instanceof ArrayableInterface)
+ {
+ return var_export($message->toArray(), true);
+ }
- return call_user_func_array(array($this, $level), array_slice(func_get_args(), 1));
+ return $message;
}
/**
- * Format the parameters for the logger.
+ * Parse the string level into a Monolog constant.
*
- * @param mixed $parameters
- * @return void
+ * @param string $level
+ * @return int
+ *
+ * @throws \InvalidArgumentException
*/
- protected function formatParameters(&$parameters)
+ protected function parseLevel($level)
{
- if (isset($parameters[0]))
+ switch ($level)
{
- if (is_array($parameters[0]))
- {
- $parameters[0] = var_export($parameters[0], true);
- }
- elseif ($parameters[0] instanceof JsonableInterface)
- {
- $parameters[0] = $parameters[0]->toJson();
- }
- elseif ($parameters[0] instanceof ArrayableInterface)
- {
- $parameters[0] = var_export($parameters[0]->toArray(), true);
- }
+ case 'debug':
+ return MonologLogger::DEBUG;
+
+ case 'info':
+ return MonologLogger::INFO;
+
+ case 'notice':
+ return MonologLogger::NOTICE;
+
+ case 'warning':
+ return MonologLogger::WARNING;
+
+ case 'error':
+ return MonologLogger::ERROR;
+
+ case 'critical':
+ return MonologLogger::CRITICAL;
+
+ case 'alert':
+ return MonologLogger::ALERT;
+
+ case 'emergency':
+ return MonologLogger::EMERGENCY;
+
+ default:
+ throw new \InvalidArgumentException("Invalid log level.");
}
}
@@ -262,6 +344,16 @@ public function getMonolog()
return $this->monolog;
}
+ /**
+ * Get a defaut Monolog formatter instance.
+ *
+ * @return \Monolog\Formatter\LineFormatter
+ */
+ protected function getDefaultFormatter()
+ {
+ return new LineFormatter(null, null, true);
+ }
+
/**
* Get the event dispatcher instance.
*
@@ -283,29 +375,4 @@ public function setEventDispatcher(Dispatcher $dispatcher)
$this->dispatcher = $dispatcher;
}
- /**
- * Dynamically handle error additions.
- *
- * @param string $method
- * @param mixed $parameters
- * @return mixed
- *
- * @throws \BadMethodCallException
- */
- public function __call($method, $parameters)
- {
- if (in_array($method, $this->levels))
- {
- $this->formatParameters($parameters);
-
- call_user_func_array(array($this, 'fireLogEvent'), array_merge(array($method), $parameters));
-
- $method = 'add'.ucfirst($method);
-
- return $this->callMonolog($method, $parameters);
- }
-
- throw new \BadMethodCallException("Method [$method] does not exist.");
- }
-
} | true |
Other | laravel | framework | 3082830437b427386870c3c52a74886646de7b26.json | Add logger contract. | tests/Log/LogWriterTest.php | @@ -35,19 +35,19 @@ public function testErrorLogHandlerCanBeAdded()
}
- public function testMagicMethodsPassErrorAdditionsToMonolog()
+ public function testMethodsPassErrorAdditionsToMonolog()
{
$writer = new Writer($monolog = m::mock('Monolog\Logger'));
- $monolog->shouldReceive('addError')->once()->with('foo')->andReturn('bar');
+ $monolog->shouldReceive('error')->once()->with('foo', []);
- $this->assertEquals('bar', $writer->error('foo'));
+ $writer->error('foo');
}
public function testWriterFiresEventsDispatcher()
{
$writer = new Writer($monolog = m::mock('Monolog\Logger'), $events = new Illuminate\Events\Dispatcher);
- $monolog->shouldReceive('addError')->once()->with('foo');
+ $monolog->shouldReceive('error')->once()->with('foo', array());
$events->listen('illuminate.log', function($level, $message, array $context = array())
{ | true |
Other | laravel | framework | 6b0985dab4f39dc243e1894d1049ab1e4951409d.json | Stop queue:work --daemon processing when app down.
Contrary to the documentation, the 'queue:work --daemon' command happily
continues on processing events after the 'down' command has been called,
which could lead to queue events being processed while database and code
migrations make the application unstable.
This fix adds a isDownForMaintenance() function into the QueueManager to
provide the Worker a way to find out if the application is down or not.
Implemented as part of the existing daemonShouldRun() function, since
that function already performs the required process of blocking future
events from being processed. | src/Illuminate/Queue/QueueManager.php | @@ -196,6 +196,16 @@ public function getName($connection = null)
return $connection ?: $this->getDefaultDriver();
}
+ /**
+ * Determine if the worker should run in maintenance mode.
+ *
+ * @return bool
+ */
+ public function isDownForMaintenance()
+ {
+ return $this->app->isDownForMaintenance();
+ }
+
/**
* Dynamically pass calls to the default connection.
*
| true |
Other | laravel | framework | 6b0985dab4f39dc243e1894d1049ab1e4951409d.json | Stop queue:work --daemon processing when app down.
Contrary to the documentation, the 'queue:work --daemon' command happily
continues on processing events after the 'down' command has been called,
which could lead to queue events being processed while database and code
migrations make the application unstable.
This fix adds a isDownForMaintenance() function into the QueueManager to
provide the Worker a way to find out if the application is down or not.
Implemented as part of the existing daemonShouldRun() function, since
that function already performs the required process of blocking future
events from being processed. | src/Illuminate/Queue/Worker.php | @@ -123,6 +123,11 @@ protected function runNextJobForDaemon($connectionName, $queue, $delay, $sleep,
*/
protected function daemonShouldRun()
{
+ if ($this->manager->isDownForMaintenance())
+ {
+ return false;
+ }
+
return $this->events->until('illuminate.queue.looping') !== false;
}
| true |
Other | laravel | framework | 2608084a12f0596f70cf5a91514345e0a661d168.json | Add ability to set beanstalkd port | src/Illuminate/Queue/Connectors/BeanstalkdConnector.php | @@ -13,7 +13,7 @@ class BeanstalkdConnector implements ConnectorInterface {
*/
public function connect(array $config)
{
- $pheanstalk = new Pheanstalk($config['host']);
+ $pheanstalk = new Pheanstalk($config['host'], array_get($config, 'port', Pheanstalk::DEFAULT_PORT));
return new BeanstalkdQueue(
$pheanstalk, $config['queue'], array_get($config, 'ttr', Pheanstalk::DEFAULT_TTR)
| false |
Other | laravel | framework | c206fa0a7fe6be8087de5b042a8ad8d81885bb2b.json | Fix queue connection binding. | src/Illuminate/Foundation/Application.php | @@ -1158,7 +1158,7 @@ public function registerCoreContainerAliases()
'paginator' => 'Illuminate\Pagination\Factory',
'auth.reminder' => ['Illuminate\Auth\Reminders\PasswordBroker', 'Illuminate\Contracts\Auth\PasswordBroker'],
'queue' => 'Illuminate\Queue\QueueManager',
- 'queue.store' => 'Illuminate\Contracts\Queue\Queue',
+ 'queue.connection' => 'Illuminate\Contracts\Queue\Queue',
'redirect' => 'Illuminate\Routing\Redirector',
'redis' => ['Illuminate\Redis\Database', 'Illuminate\Contracts\Redis\Database'],
'request' => 'Illuminate\Http\Request', | true |
Other | laravel | framework | c206fa0a7fe6be8087de5b042a8ad8d81885bb2b.json | Fix queue connection binding. | src/Illuminate/Queue/QueueServiceProvider.php | @@ -61,7 +61,7 @@ protected function registerManager()
return $manager;
});
- $this->app->bindShared('queue.driver', function($app)
+ $this->app->bindShared('queue.connection', function($app)
{
return $app['queue']->connection();
});
| true |
Other | laravel | framework | 85e114a3a7173232078571e2a54c8c56f2e8ff5c.json | Fix connection binding. | src/Illuminate/Queue/QueueServiceProvider.php | @@ -63,7 +63,7 @@ protected function registerManager()
$this->app->bindShared('queue.driver', function($app)
{
- return $app['queue']->driver();
+ return $app['queue']->connection();
});
}
| false |
Other | laravel | framework | babce912cb57699094f35c42cb133dffedb95675.json | Remove useless $app argument | src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php | @@ -103,7 +103,7 @@ protected function registerAppNameCommand()
*/
protected function registerChangesCommand()
{
- $this->app->bindShared('command.changes', function($app)
+ $this->app->bindShared('command.changes', function()
{
return new ChangesCommand;
});
@@ -142,7 +142,7 @@ protected function registerConsoleMakeCommand()
*/
protected function registerDownCommand()
{
- $this->app->bindShared('command.down', function($app)
+ $this->app->bindShared('command.down', function()
{
return new DownCommand;
});
@@ -298,7 +298,7 @@ protected function registerTinkerCommand()
*/
protected function registerUpCommand()
{
- $this->app->bindShared('command.up', function($app)
+ $this->app->bindShared('command.up', function()
{
return new UpCommand;
}); | false |
Other | laravel | framework | b546fbe937ad997fa9071e51c3522687a6cbeaf9.json | Fix auth docblocks | src/Illuminate/Auth/EloquentUserProvider.php | @@ -36,7 +36,7 @@ public function __construct(HasherContract $hasher, $model)
* Retrieve a user by their unique identifier.
*
* @param mixed $identifier
- * @return \Illuinate\Contracts\Auth\User|null
+ * @return \Illuminate\Contracts\Auth\User|null
*/
public function retrieveById($identifier)
{
@@ -48,7 +48,7 @@ public function retrieveById($identifier)
*
* @param mixed $identifier
* @param string $token
- * @return \Illuinate\Contracts\Auth\User|null
+ * @return \Illuminate\Contracts\Auth\User|null
*/
public function retrieveByToken($identifier, $token)
{
@@ -63,7 +63,7 @@ public function retrieveByToken($identifier, $token)
/**
* Update the "remember me" token for the given user in storage.
*
- * @param \Illuinate\Contracts\Auth\User $user
+ * @param \Illuminate\Contracts\Auth\User $user
* @param string $token
* @return void
*/
@@ -78,7 +78,7 @@ public function updateRememberToken(UserContract $user, $token)
* Retrieve a user by the given credentials.
*
* @param array $credentials
- * @return \Illuinate\Contracts\Auth\User|null
+ * @return \Illuminate\Contracts\Auth\User|null
*/
public function retrieveByCredentials(array $credentials)
{
@@ -98,7 +98,7 @@ public function retrieveByCredentials(array $credentials)
/**
* Validate a user against the given credentials.
*
- * @param \Illuinate\Contracts\Auth\User $user
+ * @param \Illuminate\Contracts\Auth\User $user
* @param array $credentials
* @return bool
*/ | false |
Other | laravel | framework | c03924a76733f9c120f5bab566f52007d4b1de0c.json | Use key instead of password. | src/Illuminate/Filesystem/FilesystemManager.php | @@ -111,7 +111,7 @@ public function createS3Driver(array $config)
public function createRackspaceDriver(array $config)
{
$client = new Rackspace($config['endpoint'], [
- 'username' => $config['username'], 'apiKey' => $config['password'],
+ 'username' => $config['username'], 'apiKey' => $config['key'],
]);
return $this->decorate(new Flysystem( | false |
Other | laravel | framework | cc687c786fe1552b200b6bcd81c5367cc0379b86.json | fix docblocks in filesystem | src/Illuminate/Filesystem/FilesystemDecorator.php | @@ -44,7 +44,7 @@ public function exists($path)
* @param string $path
* @return string
*
- * @throws FileNotFoundException
+ * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function get($path)
{
@@ -232,6 +232,7 @@ public function directories($directory = null, $recursive = false)
* Get all (recursive) of the directories within a given directory.
*
* @param string|null $directory
+ * @param bool $recursive
* @return array
*/
public function allDirectories($directory = null, $recursive = false)
@@ -289,6 +290,7 @@ protected function filterContentsByType($contents, $type)
*
* @param string|null $visibility
* @return string
+ * @throws \InvalidArgumentException
*/
protected function parseVisibility($visibility)
{ | false |
Other | laravel | framework | d759af406d5743644029217465b3d0fdf3e8c895.json | Update the Travis file of the workbench | src/Illuminate/Workbench/stubs/.travis.yml | @@ -1,14 +1,13 @@
language: php
php:
- - 5.3
- 5.4
- 5.5
- 5.6
- hhvm
before_script:
- - composer self-update
- - composer install --prefer-source --no-interaction --dev
+ - travis_retry composer self-update
+ - travis_retry composer install --prefer-source --no-interaction --dev
script: phpunit | false |
Other | laravel | framework | 3effef38463980fcb762cda0fc76dbc8119a0f30.json | Add contracts dependency. | src/Illuminate/Filesystem/composer.json | @@ -9,6 +9,7 @@
],
"require": {
"php": ">=5.4.0",
+ "illuminate/contracts": "4.3.*",
"illuminate/support": "4.3.*",
"symfony/finder": "2.6.*"
}, | false |
Other | laravel | framework | 257606f53a6ba5468415a0375f08440c3a4f8b69.json | Fix app:name not hitting User class. | src/Illuminate/Foundation/Console/AppNameCommand.php | @@ -95,6 +95,10 @@ protected function setAppDirectoryNamespace()
*/
protected function replaceNamespace($path)
{
+ $this->replaceIn(
+ $path, 'namespace '.$this->root().';', 'namespace '.$this->argument('name').';'
+ );
+
$this->replaceIn(
$path, 'namespace '.$this->root().'\\', 'namespace '.$this->argument('name').'\\'
); | false |
Other | laravel | framework | 2618b79a6a94ba430710fd3083b389f05d6ac8dd.json | Inject the queue driver. | src/Illuminate/Mail/MailServiceProvider.php | @@ -79,7 +79,7 @@ protected function setMailerDependencies($mailer, $app)
if ($app->bound('queue'))
{
- $mailer->setQueue($app['queue']);
+ $mailer->setQueue($app['queue.driver']);
}
}
| false |
Other | laravel | framework | 046cb9d8324752c73df5587da84376ec30abe312.json | Remove unecessary use | src/Illuminate/Auth/Console/AuthControllerCommand.php | @@ -1,6 +1,5 @@
<?php namespace Illuminate\Auth\Console;
-use Illuminate\Filesystem\Filesystem;
use Illuminate\Console\GeneratorCommand;
use Symfony\Component\Console\Input\InputArgument;
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.