<commit_before># Dotor [![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=pierre111&url=https://github.com/pklink/dodoh.git&title=Dotor&language=&tags=github&category=software)

Dotor is a simple library for PHP 5.3 and higher to access an array by using dot notification. This can be useful for handling array configurations or so…

## Installation

Install Dotor with [Composer](http://getcomposer.org/)

Create or update your `composer.json`

```json
{
    "require": {
        "pklink/dotor": "0.*"
    }
}
```

And run Composer

```sh
php composer.phar install
```

Finally include Composers autoloader

```php
include __DIR__ . '/vendor/autoload.php';
```

## Usage

Using `Dotor is very simple. Create an instance with your (configurarion) array...

```php
$config = new \Dotor\Dotor([
    'name' => 'sample configuration',
    'database' => [
        'server'   => 'localhost',
        'username' => 'root',
        'password' => 'password',
        'database' => 'blah',
        'type'     => 'sqlite'
    ],
    'object' => new stdClass()
]);
```

... and get the content by the `get()`-method.

```php
$config->get('name');
$config->get('database.server');
```

You can find more examples in the *example.php*

### Default values

```php
$config->get('asdasdas'); // returns null
$config->get('asdasdas', 'blah'); // returns 'blah'
```

### Scalar values

```php
$config->get('object'); // returns ''
$config->get('object', 'blah'); // returns 'blah'
$config->get('not-existing'); // returns ''
$config->get('not-existing', []); // throw InvalidArgumentException
```

### Arrays

```php
$config->getArray('database'); // returns the database array
$config->getArray('notexit');  // returns []
$config->getArray('notexit', [1]);  // returns [1]
```

## Run tests

```bash
php composer.phar install --dev
php vendor/bin/phpunit tests/
```
<commit_msg>fixed "###  Scalar values" in README<commit_after># Dotor [![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=pierre111&url=https://github.com/pklink/dodoh.git&title=Dotor&language=&tags=github&category=software)

Dotor is a simple library for PHP 5.3 and higher to access an array by using dot notification. This can be useful for handling array configurations or so…

## Installation

Install Dotor with [Composer](http://getcomposer.org/)

Create or update your `composer.json`

```json
{
    "require": {
        "pklink/dotor": "0.*"
    }
}
```

And run Composer

```sh
php composer.phar install
```

Finally include Composers autoloader

```php
include __DIR__ . '/vendor/autoload.php';
```

## Usage

Using `Dotor is very simple. Create an instance with your (configurarion) array...

```php
$config = new \Dotor\Dotor([
    'name' => 'sample configuration',
    'database' => [
        'server'   => 'localhost',
        'username' => 'root',
        'password' => 'password',
        'database' => 'blah',
        'type'     => 'sqlite'
    ],
    'object' => new stdClass()
]);
```

... and get the content by the `get()`-method.

```php
$config->get('name');
$config->get('database.server');
```

You can find more examples in the *example.php*

### Default values

```php
$config->get('asdasdas');         // returns null
$config->get('asdasdas', 'blah'); // returns 'blah'
```

### Scalar values

```php
$config->getScalar('object');           // returns ''
$config->getScalar('object', 'blah');   // returns 'blah'
$config->getScalar('not-existing');     // returns ''
$config->getScalar('not-existing', []); // throw InvalidArgumentException
```

### Arrays

```php
$config->getArray('database');      // returns the database array
$config->getArray('notexit');       // returns []
$config->getArray('notexit', [1]);  // returns [1]
```

## Run tests

```bash
php composer.phar install --dev
php vendor/bin/phpunit tests/
```

{'fraction_non_alphanumeric': 0.19237611181702668, 'fraction_numerical': 0.004066073697585769, 'mean_word_length': 3.7364620938628157, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 41, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '435131', 'n_tokens_mistral': 1334, 'n_tokens_neox': 1276, 'n_words': 328}