Skip to content

Commit

Permalink
Replace illuminate/support with underscore-php.
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Dec 30, 2015
1 parent d5c8a9a commit 9c3821a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@
},
"require": {
"php": ">=5.4.0",
"illuminate/support": "~5.0",
"paragonie/random_compat": "~1.1"
"anahkiasen/underscore-php": "~2.0"
},
"require-dev": {
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0"
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "1.1-dev"
}
},
"minimum-stability": "dev"
Expand Down
4 changes: 2 additions & 2 deletions src/Document.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Laravie\Parser;

use Illuminate\Support\Str;
use Underscore\Types\Strings;

abstract class Document
{
Expand Down Expand Up @@ -169,7 +169,7 @@ protected function getFilterResolver($filter)
*/
protected function parseData($data)
{
$hash = Str::random(60);
$hash = Strings::random(60);
$value = $data;
$filter = null;

Expand Down
19 changes: 11 additions & 8 deletions src/Xml/Document.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php namespace Laravie\Parser\Xml;

use SimpleXMLElement;
use Illuminate\Support\Arr;
use Underscore\Types\Arrays;
use Underscore\Types\Object;
use Laravie\Parser\Document as BaseDocument;

class Document extends BaseDocument
Expand All @@ -22,7 +23,7 @@ class Document extends BaseDocument
*/
public function rebase($base = null)
{
$this->content = data_get($this->getOriginalContent(), $base);
$this->content = Arrays::get($this->getOriginalContent(), $base);

return $this;
}
Expand Down Expand Up @@ -107,13 +108,15 @@ protected function getRawValueAttribute(SimpleXMLElement $content, $use, $defaul
{
list($value, $attribute) = explode('::', $use, 2);

if (is_null($parent = object_get($content, $value))) {
$parent = $content;

if (! empty($value) && is_null($parent = Object::get($content, $value))) {
return $default;
}

$attributes = $parent->attributes();

return Arr::get($attributes, $attribute, $default);
return Arrays::get($attributes, $attribute, $default);
}

/**
Expand All @@ -127,7 +130,7 @@ protected function getRawValueAttribute(SimpleXMLElement $content, $use, $defaul
*/
protected function getValueData(SimpleXMLElement $content, $use, $default = null)
{
$value = $this->castValue(data_get($content, $use));
$value = $this->castValue(Arrays::get($content, $use));

if (empty($value) && ! in_array($value, ['0'])) {
return $default;
Expand All @@ -154,7 +157,7 @@ protected function getValueCollection(SimpleXMLElement $content, array $matches,
list($parent, $namespace) = explode('/', $parent, 2);
}

$collection = data_get($content, $parent);
$collection = Arrays::get($content, $parent);
$namespaces = $this->getAvailableNamespaces();

$uses = explode(',', $matches[2]);
Expand Down Expand Up @@ -204,14 +207,14 @@ protected function parseValueCollection(SimpleXMLElement $content, array $uses)
if (is_null($as)) {
$value = array_merge($value, $item);
} else {
Arr::set($value, $as, $item);
$value = Arrays::set($value, $as, $item);
}
} else {
if ($name == '@') {
$name = null;
}

Arr::set($value, $as, $this->getValue($content, $name));
$value = Arrays::set($value, $as, $this->getValue($content, $name));
}
}

Expand Down

0 comments on commit 9c3821a

Please sign in to comment.