<commit_before><?php
/**
 * Go! AOP framework
 *
 * @copyright Copyright 2014, <NAME> <<EMAIL>>
 *
 * This source file is subject to the license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Go\Core;

use Doctrine\Common\Annotations\Reader;
use Go\Aop\Aspect;
use ReflectionClass;

/**
 * Cached loader is responsible for faster initialization of pointcuts/advisors for concrete aspect
 */
class CachedAspectLoader extends AspectLoader
{

    protected $cacheDir;

    /**
     * {@inheritdoc}
     * @param array $options
     */
    public function __construct(AspectContainer $container, Reader $reader, array $options = array())
    {
        parent::__construct($container, $reader);
        $this->cacheDir = $options['cacheDir'];
    }

    /**
     * {@inheritdoc}
     */
    public function load(Aspect $aspect)
    {
        $refAspect = new ReflectionClass($aspect);
        $fileName  = $this->cacheDir . '/_aspect/' . sha1($refAspect->getName());

        // If cache is present and actual, then use it
        if (file_exists($fileName) && filemtime($fileName) >= filemtime($refAspect->getFileName())) {
            $this->loadFromCache($fileName);
            $this->loadedResources[] = $refAspect->getFileName();

            return;
        }

        $pointcutsBefore = $this->container->getByTag('pointcut');
        $advisorsBefore  = $this->container->getByTag('advisor');
        parent::load($aspect);
        $pointcutsAfter = $this->container->getByTag('pointcut');
        $advisorsAfter  = $this->container->getByTag('advisor');<commit_msg>Fix a notice if key is not present in the options array<commit_after><?php
/**
 * Go! AOP framework
 *
 * @copyright Copyright 2014, <NAME> <<EMAIL>>
 *
 * This source file is subject to the license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Go\Core;

use Doctrine\Common\Annotations\Reader;
use Go\Aop\Aspect;
use ReflectionClass;

/**
 * Cached loader is responsible for faster initialization of pointcuts/advisors for concrete aspect
 */
class CachedAspectLoader extends AspectLoader
{

    protected $cacheDir;

    /**
     * {@inheritdoc}
     * @param array $options
     */
    public function __construct(AspectContainer $container, Reader $reader, array $options = array())
    {
        parent::__construct($container, $reader);
        $this->cacheDir = isset($options['cacheDir']) ? $options['cacheDir'] : null;
    }

    /**
     * {@inheritdoc}
     */
    public function load(Aspect $aspect)
    {
        $refAspect = new ReflectionClass($aspect);
        $fileName  = $this->cacheDir . '/_aspect/' . sha1($refAspect->getName());

        // If cache is present and actual, then use it
        if (file_exists($fileName) && filemtime($fileName) >= filemtime($refAspect->getFileName())) {
            $this->loadFromCache($fileName);
            $this->loadedResources[] = $refAspect->getFileName();

            return;
        }

        $pointcutsBefore = $this->container->getByTag('pointcut');
        $advisorsBefore  = $this->container->getByTag('advisor');
        parent::load($aspect);
        $pointcutsAfter = $this->container->getByTag('pointcut');
        $advisorsAfter  = $this->container->getByTag('advisor');
{'fraction_non_alphanumeric': 0.13945682026243517, 'fraction_numerical': 0.003051571559353067, 'mean_word_length': 3.0872817955112217, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 41, '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': '7301023', 'n_tokens_mistral': 965, 'n_tokens_neox': 939, 'n_words': 230}