<commit_before>The Puli Discovery Component
============================

[![Build Status](https://travis-ci.org/puli/discovery.svg?branch=master)](https://travis-ci.org/puli/discovery)
[![Build status](https://ci.appveyor.com/api/projects/status/wmg14bydks4xwqs2/branch/master?svg=true)](https://ci.appveyor.com/project/webmozart/discovery/branch/master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/puli/discovery/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/puli/discovery/?branch=master)
[![Latest Stable Version](https://poser.pugx.org/puli/discovery/v/stable.svg)](https://packagist.org/packages/puli/discovery)
[![Total Downloads](https://poser.pugx.org/puli/discovery/downloads.svg)](https://packagist.org/packages/puli/discovery)
[![Dependency Status](https://www.versioneye.com/php/puli:discovery/1.0.0/badge.svg)](https://www.versioneye.com/php/puli:discovery/1.0.0)

Latest release: [1.0.0-beta7](https://packagist.org/packages/puli/discovery#1.0.0-beta7)

PHP >= 5.3.9

The [Puli] Discovery Component supports binding of Puli resources to *binding
types*. Binding types can be defined with the `addBindingType()` method of the 
[`EditableDiscovery`] interface:

```php
use Puli\Discovery\Api\Type\BindingType;
use Puli\Discovery\Binding\Initializer\ResourceBindingInitializer;
use Puli\Discovery\InMemoryDiscovery;

$discovery = new InMemoryDiscovery(array(
    // $repo is a Puli\Repository\Api\ResourceRepository instance
    new ResourceBindingInitializer($repo),
));

$discovery->addBindingType(new BindingType('doctrine/xml-mapping'));
```

Resource Bindings
-----------------

Resources in the repository can then be bound to the defined type by passing a
`ResourceBinding` to `addBinding()`:

```php
use Puli\Discovery\Binding\ResourceBinding;

$discovery->addBinding(new ResourceBinding('/app/config/doctrine/*.xml', 'doctrine/xml-mapping'));<commit_msg>Updated latest version to "1.0.0-beta8"<commit_after>The Puli Discovery Component
============================

[![Build Status](https://travis-ci.org/puli/discovery.svg?branch=master)](https://travis-ci.org/puli/discovery)
[![Build status](https://ci.appveyor.com/api/projects/status/wmg14bydks4xwqs2/branch/master?svg=true)](https://ci.appveyor.com/project/webmozart/discovery/branch/master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/puli/discovery/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/puli/discovery/?branch=master)
[![Latest Stable Version](https://poser.pugx.org/puli/discovery/v/stable.svg)](https://packagist.org/packages/puli/discovery)
[![Total Downloads](https://poser.pugx.org/puli/discovery/downloads.svg)](https://packagist.org/packages/puli/discovery)
[![Dependency Status](https://www.versioneye.com/php/puli:discovery/1.0.0/badge.svg)](https://www.versioneye.com/php/puli:discovery/1.0.0)

Latest release: [1.0.0-beta8](https://packagist.org/packages/puli/discovery#1.0.0-beta8)

PHP >= 5.3.9

The [Puli] Discovery Component supports binding of Puli resources to *binding
types*. Binding types can be defined with the `addBindingType()` method of the 
[`EditableDiscovery`] interface:

```php
use Puli\Discovery\Api\Type\BindingType;
use Puli\Discovery\Binding\Initializer\ResourceBindingInitializer;
use Puli\Discovery\InMemoryDiscovery;

$discovery = new InMemoryDiscovery(array(
    // $repo is a Puli\Repository\Api\ResourceRepository instance
    new ResourceBindingInitializer($repo),
));

$discovery->addBindingType(new BindingType('doctrine/xml-mapping'));
```

Resource Bindings
-----------------

Resources in the repository can then be bound to the defined type by passing a
`ResourceBinding` to `addBinding()`:

```php
use Puli\Discovery\Binding\ResourceBinding;

$discovery->addBinding(new ResourceBinding('/app/config/doctrine/*.xml', 'doctrine/xml-mapping'));
{'fraction_non_alphanumeric': 0.1803748047891723, 'fraction_numerical': 0.011972930765226444, 'mean_word_length': 5.765845070422535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 26, 'lorem ipsum': 0, 'www.': 4, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6138961', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1259, 'n_words': 189}