<commit_before><?php

/*
 * This file is part of the Autoloader package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Exorg\Autoloader;

/**
 * FixedAutoloadingStrategy.
 * Autoloading strategy for fixed paths.
 *
 * @package Autoloader
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2015 <NAME>
 * @license http://http://opensource.org/licenses/MIT MIT License
 * @link https://github.com/ExOrg/php-autoloader
 */
class FixedAutoloadingStrategy extends AbstractAutoloadingStrategy
{
    /**
     * Class full names with assigned directory path.
     *
     * @var array[string]string | array[]
     */
    protected $classPaths = array();

    /**
     * Currently processed class name.
     *
     * @var string | null
     */
    protected $currentClass = null;

    /**
     * Register class full name and assign a directory path.
     *
     * @param string $class
     * @param string $path
     */
    public function registerClassPath($class, $path)
    {
        $this->classPaths[$class] = $path;
    }

    /**
     * Extract class paramaters like namespace or class name
     * needed in file searching process
     * and assign their values to the strategy class variables.
     *
     * @param string $class
     */
    public function extractClassParameters($class)
    {
        $this->currentClass = $class;
    }

    /**
     * Find full path of the file that contains
     * the declaration of the automatically loaded class.
     *
     * @return string | null
     */
    protected function findClassFilePath()
    {
        foreach ($this->classPaths as $class => $path) {
            $pathIsNotRegistered = (0 !== strpos(strrev($this->currentClass), strrev($class)));
            if ($pathIsNotRegistered) {
                continue;
            }

            $classFileExists = is_file($path);

            if ($classFileExists) {
                return $path;
            }
        }
    }
}<commit_msg>Fixed Autoloading Strategy class refactoring (#3)<commit_after><?php

/*
 * This file is part of the Autoloader package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Exorg\Autoloader;

/**
 * FixedAutoloadingStrategy.
 * Autoloading strategy for fixed paths.
 *
 * @package Autoloader
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2015 <NAME>
 * @license http://http://opensource.org/licenses/MIT MIT License
 * @link https://github.com/ExOrg/php-autoloader
 */
class FixedAutoloadingStrategy extends AbstractAutoloadingStrategy
{
    /**
     * Class full names with assigned directory path.
     *
     * @var array[string]string | array[]
     */
    protected $classPaths = array();

    /**
     * Currently processed class name.
     *
     * @var string | null
     */
    protected $processedClass = null;

    /**
     * Register class full name and assign a directory path.
     *
     * @param string $class
     * @param string $path
     */
    public function registerClassPath($class, $path)
    {
        $this->classPaths[$class] = $path;
    }

    /**
     * Extract class paramaters like namespace or class name
     * needed in file searching process
     * and assign their values to the strategy class variables.
     *
     * @param string $class
     */
    public function extractClassParameters($class)
    {
        $this->processedClass = $class;
    }

    /**
     * Find full path of the file that contains
     * the declaration of the automatically loaded class.
     *
     * @return string | null
     */
    protected function findClassFilePath()
    {
        foreach ($this->classPaths as $class => $path) {
            $pathIsNotRegistered = (0 !== strpos(strrev($this->processedClass), strrev($class)));

            if ($pathIsNotRegistered) {
                continue;
            }

            $classFileExists = is_file($path);

            if ($classFileExists) {
                return $path;
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.11041916167664671, 'fraction_numerical': 0.0026347305389221557, 'mean_word_length': 2.301185770750988, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 27, 'https://': 2, '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': '6416830', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1146, 'n_words': 349}