Skip to content

Commit

Permalink
Merge pull request tighten#56 from tightenco/kd-tightenco-namespace
Browse files Browse the repository at this point in the history
Change namespace to TightenCo and alias to Illuminate namespace
  • Loading branch information
mattstauffer authored Jan 31, 2018
2 parents 0db8c8a + 782942d commit 939558f
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 36 deletions.
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@
}
],
"require": {
"php": ">=7.0"
"php": ">=7.0",
"symfony/var-dumper": "~3.3"
},
"require-dev": {
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0"
},
"autoload": {
"files": [
"src/Illuminate/Support/helpers.php"
"src/Tightenco/Support/helpers.php",
"src/Tightenco/Support/alias.php"
],
"psr-4": {
"Illuminate\\": "src/Illuminate"
"Tightenco\\": "src/Tightenco"
}
},
"suggest": {
"symfony/var-dumper": "Required to prettify dd() and dump() (~3.3)."
},
"minimum-stability": "dev",
"prefer-stable": true
}
133 changes: 131 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Illuminate\Contracts\Support;
namespace Tightenco\Contracts\Support;

interface Arrayable
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Illuminate\Contracts\Support;
namespace Tightenco\Contracts\Support;

interface Htmlable
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Illuminate\Contracts\Support;
namespace Tightenco\Contracts\Support;

interface Jsonable
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Illuminate\Support;
namespace Tightenco\Support;

use ArrayAccess;
use InvalidArgumentException;
use Illuminate\Support\Traits\Macroable;
use Tightenco\Support\Traits\Macroable;

class Arr
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Illuminate\Support;
namespace Tightenco\Support;

use stdClass;
use Countable;
Expand All @@ -11,10 +11,10 @@
use CachingIterator;
use JsonSerializable;
use IteratorAggregate;
use Illuminate\Support\Debug\Dumper;
use Illuminate\Support\Traits\Macroable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Support\Arrayable;
use Tightenco\Support\Debug\Dumper;
use Tightenco\Support\Traits\Macroable;
use Tightenco\Contracts\Support\Jsonable;
use Tightenco\Contracts\Support\Arrayable;

class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable
{
Expand Down Expand Up @@ -1677,7 +1677,7 @@ public function count()
/**
* Get a base Support collection instance from this collection.
*
* @return \Illuminate\Support\Collection
* @return \Tightenco\Support\Collection
*/
public function toBase()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Illuminate\Support\Debug;
namespace Tightenco\Support\Debug;

use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\CliDumper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Illuminate\Support\Debug;
namespace Tightenco\Support\Debug;

use Symfony\Component\VarDumper\Dumper\HtmlDumper as SymfonyHtmlDumper;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php

namespace Illuminate\Support;
namespace Tightenco\Support;

/**
* @mixin \Illuminate\Support\Collection
* @mixin \Tightenco\Support\Collection
*/
class HigherOrderCollectionProxy
{
/**
* The collection being operated on.
*
* @var \Illuminate\Support\Collection
* @var \Tightenco\Support\Collection
*/
protected $collection;

Expand All @@ -24,7 +24,7 @@ class HigherOrderCollectionProxy
/**
* Create a new proxy instance.
*
* @param \Illuminate\Support\Collection $collection
* @param \Tightenco\Support\Collection $collection
* @param string $method
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Illuminate\Support;
namespace Tightenco\Support;

use Illuminate\Contracts\Support\Htmlable;
use Tightenco\Contracts\Support\Htmlable;

class HtmlString implements Htmlable
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Illuminate\Support\Traits;
namespace Tightenco\Support\Traits;

use Closure;
use ReflectionClass;
Expand Down
35 changes: 35 additions & 0 deletions src/Tightenco/Support/alias.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

$aliases = [
/**
* Contracts
*/
Tightenco\Contracts\Support\Arrayable::class => Illuminate\Contracts\Support\Arrayable::class,
Tightenco\Contracts\Support\Htmlable::class => Illuminate\Contracts\Support\Htmlable::class,
Tightenco\Contracts\Support\Jsonable::class => Illuminate\Contracts\Support\Jsonable::class,

/**
* Support
*/
Tightenco\Support\Arr::class => Illuminate\Support\Arr::class,
Tightenco\Support\Collection::class => Illuminate\Support\Collection::class,
Tightenco\Support\HigherOrderCollectionProxy::class => Illuminate\Support\HigherOrderCollectionProxy::class,
Tightenco\Support\HtmlString::class => Illuminate\Support\HtmlString::class,

/**
* Support\Debug
*/
Tightenco\Support\Debug\Dumper::class => Illuminate\Support\Debug\Dumper::class,
Tightenco\Support\Debug\HtmlDumper::class => Illuminate\Support\Debug\HtmlDumper::class,

/**
* Support\Traits
*/
Tightenco\Support\Traits\Macroable::class => Illuminate\Support\Traits\Macroable::class,
];

foreach ($aliases as $tighten => $illuminate) {
if (! class_exists($illuminate) && ! interface_exists($illuminate) && ! trait_exists($illuminate)) {
class_alias($tighten, $illuminate);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function array_wrap($value)
* Create a collection from the given value.
*
* @param mixed $value
* @return \Illuminate\Support\Collection
* @return \Tightenco\Support\Collection
*/
function collect($value = null)
{
Expand Down
14 changes: 7 additions & 7 deletions tests/Support/SupportCollectionTest.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php

namespace Illuminate\Tests\Support;
namespace Tightenco\Tests\Support;

use stdClass;
use ArrayAccess;
use Mockery as m;
use ReflectionClass;
use JsonSerializable;
use PHPUnit\Framework\TestCase;
use Illuminate\Support\Collection;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Support\Arrayable;
use Tightenco\Support\Collection;
use Tightenco\Contracts\Support\Jsonable;
use Tightenco\Contracts\Support\Arrayable;

class SupportCollectionTest extends TestCase
{
Expand Down Expand Up @@ -173,9 +173,9 @@ public function testGetArrayableItems()

public function testToArrayCallsToArrayOnEachItemInCollection()
{
$item1 = m::mock('Illuminate\Contracts\Support\Arrayable');
$item1 = m::mock('Tightenco\Contracts\Support\Arrayable');
$item1->shouldReceive('toArray')->once()->andReturn('foo.array');
$item2 = m::mock('Illuminate\Contracts\Support\Arrayable');
$item2 = m::mock('Tightenco\Contracts\Support\Arrayable');
$item2->shouldReceive('toArray')->once()->andReturn('bar.array');
$c = new Collection([$item1, $item2]);
$results = $c->toArray();
Expand All @@ -187,7 +187,7 @@ public function testJsonSerializeCallsToArrayOrJsonSerializeOnEachItemInCollecti
{
$item1 = m::mock('JsonSerializable');
$item1->shouldReceive('jsonSerialize')->once()->andReturn('foo.json');
$item2 = m::mock('Illuminate\Contracts\Support\Arrayable');
$item2 = m::mock('Tightenco\Contracts\Support\Arrayable');
$item2->shouldReceive('toArray')->once()->andReturn('bar.array');
$c = new Collection([$item1, $item2]);
$results = $c->jsonSerialize();
Expand Down

0 comments on commit 939558f

Please sign in to comment.