<commit_before><?php
namespace Poirot\Storage\Gateway;

use Poirot\Storage\Interfaces\iStorageData;

use Poirot\Std\ConfigurableSetter;
use Poirot\Std\Interfaces\Struct\iDataEntity;
use Poirot\Std\Struct\DataEntity;

/*
$s = new P\Storage\Gateway\DataStorageBase('my_realm');
$s->setData([
    'name'   => 'Payam',
    'family' => 'Naderi',
]);

$s->setRealm('new');
print_r(P\Std\cast($s)->toArray()); // Array ( )

$s->setRealm('my_realm');
$s->import(['email'  => '<EMAIL>']);
print_r(P\Std\cast($s)->toArray()); // Array ( [name] => Payam [family] => Naderi [email] => <EMAIL> )
*/

class DataStorageBase 
    extends ConfigurableSetter
    implements iStorageData
{
    const REALM_DEFAULT = 'poirot_storage_realm';

    /** @var string Storage Domain Realm*/
    protected $realm;
    protected $realmStorage;


    /**
     * Construct
     *
     * @param string|array|\Traversable $realm   Realm or Setter Options
     * @param array|\Traversable        $setter  Setter Options
     */
    function __construct($realm = null, $setter = null)
    {
        if (is_string($realm))
            $this->setRealm($realm);
        else
            $setter = $realm;

        $this->putBuildPriority(array('realm'));
        parent::__construct($setter);
    }

    /**
     * Set Storage Domain Realm
     *
     * @param string $realm Storage Identity
     *
     * @return $this
     */
    function setRealm($realm)
    {
        $this->realm = (string) $realm;
        return $this;
    }

    /**
     * Get Current Storage Realm Domain
     *
     * @return string
     */
    function getRealm()
    {
        if (!$this->realm)
            $this->setRealm(self::REALM_DEFAULT);

        return $this->realm;
    }

    /**
     * Destroy Current Realm Data Source
     *
     * @return void
     */
    function destroy()
    {
        $this->clean();
    }

    
    // Options:
    
    /**
     * Set Data For This Realm
     *
     * @param $data
     *
     * @return $this
     */
    function setData($data)
    {<commit_msg>code cleanup<commit_after><?php
namespace Poirot\Storage\Gateway;

use Poirot\Storage\Interfaces\iStorageData;

use Poirot\Std\ConfigurableSetter;
use Poirot\Std\Interfaces\Struct\iDataEntity;
use Poirot\Std\Struct\DataEntity;

/*
$s = new P\Storage\Gateway\DataStorageBase('my_realm');
$s->setData([
    'name'   => 'Payam',
    'family' => 'Naderi',
]);

$s->setRealm('new');
print_r(P\Std\cast($s)->toArray()); // Array ( )

$s->setRealm('my_realm');
$s->import(['email'  => '<EMAIL>']);
print_r(P\Std\cast($s)->toArray()); // Array ( [name] => Payam [family] => Naderi [email] => <EMAIL> )
*/

class DataStorageBase 
    extends ConfigurableSetter
    implements iStorageData
{
    const REALM_DEFAULT = 'poirot_storage_realm';

    /** @var string Storage Domain Realm*/
    protected $realm;
    protected $realmStorage;


    /**
     * Construct
     *
     * @param string|array|\Traversable $realm   Realm or Setter Options
     * @param array|\Traversable        $setter  Setter Options
     */
    function __construct($realm = null, $setter = null)
    {
        if (is_string($realm))
            $this->setRealm($realm);
        else
            $setter = $realm;

        $this->putBuildPriority(array('realm'));
        parent::__construct($setter);
    }

    /**
     * Set Storage Domain Realm
     *
     * @param string $realm Storage Identity
     *
     * @return $this
     */
    function setRealm($realm)
    {
        $this->realm = (string) $realm;
        return $this;
    }

    /**
     * Get Current Storage Realm Domain
     *
     * @return string
     */
    function getRealm()
    {
        if (!$this->realm)
            $this->realm = self::REALM_DEFAULT;

        return $this->realm;
    }

    /**
     * Destroy Current Realm Data Source
     *
     * @return void
     */
    function destroy()
    {
        $this->clean();
    }

    
    // Options:
    
    /**
     * Set Data For This Realm
     *
     * @param $data
     *
     * @return $this
     */
    function setData($data)
    {
{'fraction_non_alphanumeric': 0.15265866209262435, 'fraction_numerical': 0.0, 'mean_word_length': 2.2141732283464566, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 45, 'https://': 0, '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': '2458618', 'n_tokens_mistral': 1393, 'n_tokens_neox': 1370, 'n_words': 264}