renaming, for reasons
This commit is contained in:
parent
bf52525a82
commit
36f787ca8f
11 changed files with 27 additions and 27 deletions
10
README.md
10
README.md
|
@ -1,8 +1,8 @@
|
||||||
# flatarray
|
# Flatrr
|
||||||
|
|
||||||
## What flatarray does
|
## What Flatrr does
|
||||||
|
|
||||||
Flatarray is a utility library for accessing arrays via flattened key names. So, for example, rather than using `$arr['foo']['bar']` you could use `$arr['foo.bar']`. Mostly this is useful if you want to use string building to make the keys you're going to use to access an array.
|
Flatrr is a utility library for accessing arrays via flattened key names. So, for example, rather than using `$arr['foo']['bar']` you could use `$arr['foo.bar']`. Mostly this is useful if you want to use string building to make the keys you're going to use to access an array.
|
||||||
|
|
||||||
It should be noted that because of the way arrays and references work, this is not going to work *exactly* the same way as a native array in all cases. There are actually countless tiny caveats, and with that in mind you should generally stick to using this library as it is documented. Using undocumented features is exceptionally unpredictable due to the nature of this tool, and things may work radically different under the hood in the future.
|
It should be noted that because of the way arrays and references work, this is not going to work *exactly* the same way as a native array in all cases. There are actually countless tiny caveats, and with that in mind you should generally stick to using this library as it is documented. Using undocumented features is exceptionally unpredictable due to the nature of this tool, and things may work radically different under the hood in the future.
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ The main FlatArray class is very simple. It only implements \Array and \Iterator
|
||||||
// Instantiating FlatArrays can be done by passing them an array
|
// Instantiating FlatArrays can be done by passing them an array
|
||||||
// Keys in the initial array will be unflattened, for example the following
|
// Keys in the initial array will be unflattened, for example the following
|
||||||
// yields a FlatArray containing ['foo'=>'bar','bar'=>['baz'=>'a','buz'=>'u']]
|
// yields a FlatArray containing ['foo'=>'bar','bar'=>['baz'=>'a','buz'=>'u']]
|
||||||
$f = new \FlatArray\FlatArray([
|
$f = new \Flatrr\FlatArray([
|
||||||
'foo' => 'bar',
|
'foo' => 'bar',
|
||||||
'bar.baz' => 'a',
|
'bar.baz' => 'a',
|
||||||
'bar.buz' => 'u'
|
'bar.buz' => 'u'
|
||||||
|
@ -49,7 +49,7 @@ $f['foo']['bar'] = 'baz';
|
||||||
SelfReferencingFlatArray is a class that does everything FlatArray does, but also allows strings within the array to reference other fields within the array, and include them as strings. For example:
|
SelfReferencingFlatArray is a class that does everything FlatArray does, but also allows strings within the array to reference other fields within the array, and include them as strings. For example:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$f = new \FlatArray\SelfReferencingFlatArray([
|
$f = new \Flatrr\SelfReferencingFlatArray([
|
||||||
'foo.bar' => 'baz',
|
'foo.bar' => 'baz',
|
||||||
'foo.baz' => '${foo.bar}'
|
'foo.baz' => '${foo.bar}'
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -12,12 +12,12 @@
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"FlatArray\\": "src/"
|
"Flatrr\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"FlatArray\\": "tests/"
|
"Flatrr\\": "tests/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
/* FlatArray | https://gitlab.com/byjoby/flatarray | MIT License */
|
/* Flatrr | https://gitlab.com/byjoby/flatrr | MIT License */
|
||||||
namespace FlatArray\Config;
|
namespace Flatrr\Config;
|
||||||
|
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
use FlatArray\SelfReferencingFlatArray;
|
use Flatrr\SelfReferencingFlatArray;
|
||||||
use FlatArray\FlatArray;
|
use Flatrr\FlatArray;
|
||||||
|
|
||||||
class Config extends SelfReferencingFlatArray implements ConfigInterface
|
class Config extends SelfReferencingFlatArray implements ConfigInterface
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/* FlatArray | https://gitlab.com/byjoby/flatarray | MIT License */
|
/* Flatrr | https://gitlab.com/byjoby/flatrr | MIT License */
|
||||||
namespace FlatArray\Config;
|
namespace Flatrr\Config;
|
||||||
|
|
||||||
interface ConfigInterface extends \ArrayAccess
|
interface ConfigInterface extends \ArrayAccess
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/* FlatArray | https://gitlab.com/byjoby/flatarray | MIT License */
|
/* Flatrr | https://gitlab.com/byjoby/flatrr | MIT License */
|
||||||
namespace FlatArray;
|
namespace Flatrr;
|
||||||
|
|
||||||
class FlatArray implements FlatArrayInterface
|
class FlatArray implements FlatArrayInterface
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/* FlatArray | https://gitlab.com/byjoby/flatarray | MIT License */
|
/* Flatrr | https://gitlab.com/byjoby/flatrr | MIT License */
|
||||||
namespace FlatArray;
|
namespace Flatrr;
|
||||||
|
|
||||||
interface FlatArrayInterface extends \ArrayAccess, \Iterator
|
interface FlatArrayInterface extends \ArrayAccess, \Iterator
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/* FlatArray | https://gitlab.com/byjoby/flatarray | MIT License */
|
/* Flatrr | https://gitlab.com/byjoby/flatrr | MIT License */
|
||||||
namespace FlatArray;
|
namespace Flatrr;
|
||||||
|
|
||||||
class SelfReferencingFlatArray extends FlatArray
|
class SelfReferencingFlatArray extends FlatArray
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/* FlatArray | https://gitlab.com/byjoby/flatarray | MIT License */
|
/* Flatrr | https://gitlab.com/byjoby/flatrr | MIT License */
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace FlatArray\Config;
|
namespace Flatrr\Config;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/* FlatArray | https://gitlab.com/byjoby/flatarray | MIT License */
|
/* Flatrr | https://gitlab.com/byjoby/flatrr | MIT License */
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace FlatArray;
|
namespace Flatrr;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/* FlatArray | https://gitlab.com/byjoby/flatarray | MIT License */
|
/* Flatrr | https://gitlab.com/byjoby/flatrr | MIT License */
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace FlatArray;
|
namespace Flatrr;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/* FlatArray | https://gitlab.com/byjoby/flatarray | MIT License */
|
/* Flatrr | https://gitlab.com/byjoby/flatrr | MIT License */
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace FlatArray;
|
namespace Flatrr;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue