<commit_before><?php namespace Orchestra\Auth\Acl;

use InvalidArgumentException;
use RuntimeException;
use Orchestra\Auth\Guard;
use Orchestra\Memory\Abstractable\Container as AbstractableContainer;
use Orchestra\Memory\Provider;
use Orchestra\Support\Str;

class Container extends AbstractableContainer
{
    /**
     * Auth instance.
     *
     * @var \Orchestra\Auth\Guard
     */
    protected $auth;

    /**
     * Acl instance name.
     *
     * @var string
     */
    protected $name;

    /**
     * List of roles.
     *
     * @var Fluent
     */
    protected $roles;

    /**
     * List of actions.
     *
     * @var Fluent
     */
    protected $actions;

    /**
     * List of ACL map between roles, action.
     *
     * @var array
     */
    protected $acl = array();

    /**
     * Construct a new object.
     *
     * @param  \Orchestra\Auth\Guard        $auth
     * @param  string                       $name
     * @param  \Orchestra\Memory\Provider   $memory
     */
    public function __construct(Guard $auth, $name, Provider $memory = null)
    {
        $this->auth    = $auth;
        $this->name    = $name;
        $this->roles   = new Fluent('roles');
        $this->actions = new Fluent('actions');

        $this->roles->add('guest');
        $this->attach($memory);
    }

    /**
     * Bind current ACL instance with a Memory instance.
     *
     * @param  \Orchestra\Memory\Provider  $memory
     * @return Container
     * @throws \RuntimeException if `\Orchestra\Memory\Provider` has
     *                           been attached.
     */
    public function attach(Provider $memory = null)
    {
        if ($this->attached() && $memory !== $this->memory) {
            throw new RuntimeException(
                "Unable to assign multiple Orchestra\Memory instance."
            );
        }

        // since we already check instanceof Orchestra\Memory\Provider,
        // It safe to just check for not NULL.
        if (! is_null($memory)) {
            parent::attach($memory);<commit_msg>Use Orchestra\Memory\ContainerTrait.<commit_after><?php namespace Orchestra\Auth\Acl;

use InvalidArgumentException;
use RuntimeException;
use Orchestra\Auth\Guard;
use Orchestra\Memory\ContainerTrait;
use Orchestra\Memory\Provider;
use Orchestra\Support\Str;

class Container
{
    use ContainerTrait;
    /**
     * Auth instance.
     *
     * @var \Orchestra\Auth\Guard
     */
    protected $auth;

    /**
     * Acl instance name.
     *
     * @var string
     */
    protected $name;

    /**
     * List of roles.
     *
     * @var Fluent
     */
    protected $roles;

    /**
     * List of actions.
     *
     * @var Fluent
     */
    protected $actions;

    /**
     * List of ACL map between roles, action.
     *
     * @var array
     */
    protected $acl = array();

    /**
     * Construct a new object.
     *
     * @param  \Orchestra\Auth\Guard        $auth
     * @param  string                       $name
     * @param  \Orchestra\Memory\Provider   $memory
     */
    public function __construct(Guard $auth, $name, Provider $memory = null)
    {
        $this->auth    = $auth;
        $this->name    = $name;
        $this->roles   = new Fluent('roles');
        $this->actions = new Fluent('actions');

        $this->roles->add('guest');
        $this->attach($memory);
    }

    /**
     * Bind current ACL instance with a Memory instance.
     *
     * @param  \Orchestra\Memory\Provider  $memory
     * @return Container
     * @throws \RuntimeException if `\Orchestra\Memory\Provider` has
     *                           been attached.
     */
    public function attach(Provider $memory = null)
    {
        if ($this->attached() && $memory !== $this->memory) {
            throw new RuntimeException(
                "Unable to assign multiple Orchestra\Memory instance."
            );
        }

        // since we already check instanceof Orchestra\Memory\Provider,
        // It safe to just check for not NULL.
        if (! is_null($memory)) {
            $this->setMemoryProvider($memory);
{'fraction_non_alphanumeric': 0.12224938875305623, 'fraction_numerical': 0.0, 'mean_word_length': 1.8001368925393566, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1064856', 'n_tokens_mistral': 1169, 'n_tokens_neox': 1152, 'n_words': 294}