<commit_before>contextual
==========
**Elegant object-oriented context pattern implementation**

[![Build Status][travis-image]][travis-url]
[![Code Quality][scrutinizer-g-image]][scrutinizer-g-url]
[![Code Coverage][coveralls-image]][coveralls-url]
[![Packagist Version][packagist-image]][packagist-url]

#### todo
 - Add example
 
[travis-image]: https://img.shields.io/travis/jmversteeg/contextual.svg?style=flat-square
[travis-url]: https://travis-ci.org/jmversteeg/contextual

[scrutinizer-g-image]: https://img.shields.io/scrutinizer/g/jmversteeg/contextual.svg?style=flat-square
[scrutinizer-g-url]: https://scrutinizer-ci.com/g/jmversteeg/contextual/<commit_msg>Added an example in the README.md [ci-skip]<commit_after>contextual
==========
**Elegant object-oriented context pattern implementation**

[![Build Status][travis-image]][travis-url]
[![Code Quality][scrutinizer-g-image]][scrutinizer-g-url]
[![Code Coverage][coveralls-image]][coveralls-url]
[![Packagist Version][packagist-image]][packagist-url]

#### example usage

```php

class ResponseContext extends \jmversteeg\contextual\Context
{

    // Declare default values with a preceding underscore
    private $_JSON  = false;
    private $_admin = false;

    /**
     * @return boolean
     */
    public function isJSON ()
    {
        return $this->JSON;
    }

    /**
     * @param boolean $JSON
     */
    public function setJSON ($JSON)
    {
        $this->JSON = $JSON;
    }

    /**
     * @return boolean
     */
    public function isAdmin ()
    {
        return $this->admin;
    }

    /**
     * @param boolean $admin
     */
    public function setAdmin ($admin)
    {
        $this->admin = $admin;
    }
}

$responseContext = new ResponseContext();
$responseContext->setJSON(true);

$responseContext->isJSON();
// => true
$responseContext->isAdmin();
// => false

$subContext = $responseContext->createSubContext();
$subContext->setAdmin(true);

$subContext->isJSON();
// => true
$subContext->isAdmin();
// => true

```
 
[travis-image]: https://img.shields.io/travis/jmversteeg/contextual.svg?style=flat-square
[travis-url]: https://travis-ci.org/jmversteeg/contextual

[scrutinizer-g-image]: https://img.shields.io/scrutinizer/g/jmversteeg/contextual.svg?style=flat-square
[scrutinizer-g-url]: https://scrutinizer-ci.com/g/jmversteeg/contextual/
{'fraction_non_alphanumeric': 0.17564102564102563, 'fraction_numerical': 0.0, 'mean_word_length': 3.970276008492569, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 8, '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': '3446534', 'n_tokens_mistral': 823, 'n_tokens_neox': 809, 'n_words': 119}