<commit_before><?php

namespace RolesCapabilities\Access;

use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\ORM\Table;
use Cake\ORM\TableRegistry;
use Cake\Utility\Inflector;
use DirectoryIterator;
use ReflectionClass;
use ReflectionMethod;
use RolesCapabilities\Capability as Cap;

/**
 *  Utils class with common methos for Capabilities
 *
 *
 */
class Utils
{
    /**
     * Full type capability identifier
     */
    const CAP_TYPE_FULL = 'full';

    /**
     * Owner type capability identifier
     */
    const CAP_TYPE_OWNER = 'owner';

    /**
     * Parent type capability identifier
     */
    const CAP_TYPE_PARENT = 'parent';

    /**
     * Non-assigned actions
     *
     * @var array
     */
    protected static $_nonAssignedActions = [
        'add'
    ];

    protected static $_capabilitiesTable = null;

    /**
     * Returns Controller's class name namespaced.
     *
     * @param array $url array of URL parameters.
     * @return string
     */
    public static function getControllerFullName(array $url)
    {
        $result = null;

        if (empty($url['controller'])) {
            return $result;
        }

        $class = $url['controller'];
        if (!empty($url['plugin'])) {
            $class = $url['plugin'] . '.' . $class;
        }
        $result = App::className($class . 'Controller', 'Controller');

        return $result;
    }

    /**
     * Get full type capability identifier.
     *
     * @return string
     */
    public static function getTypeFull()
    {
        return static::CAP_TYPE_FULL;
    }

    /**
     * Get owner type capability identifier.
     *
     * @return string
     */
    public static function getTypeOwner()
    {
        return static::CAP_TYPE_OWNER;
    }

    /**
     * Method that retrieves and returns Controller public methods.
     *<commit_msg>Added parent type getter method (task #4178)<commit_after><?php

namespace RolesCapabilities\Access;

use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\ORM\Table;
use Cake\ORM\TableRegistry;
use Cake\Utility\Inflector;
use DirectoryIterator;
use ReflectionClass;
use ReflectionMethod;
use RolesCapabilities\Capability as Cap;

/**
 *  Utils class with common methos for Capabilities
 *
 *
 */
class Utils
{
    /**
     * Full type capability identifier
     */
    const CAP_TYPE_FULL = 'full';

    /**
     * Owner type capability identifier
     */
    const CAP_TYPE_OWNER = 'owner';

    /**
     * Parent type capability identifier
     */
    const CAP_TYPE_PARENT = 'parent';

    /**
     * Non-assigned actions
     *
     * @var array
     */
    protected static $_nonAssignedActions = [
        'add'
    ];

    protected static $_capabilitiesTable = null;

    /**
     * Returns Controller's class name namespaced.
     *
     * @param array $url array of URL parameters.
     * @return string
     */
    public static function getControllerFullName(array $url)
    {
        $result = null;

        if (empty($url['controller'])) {
            return $result;
        }

        $class = $url['controller'];
        if (!empty($url['plugin'])) {
            $class = $url['plugin'] . '.' . $class;
        }
        $result = App::className($class . 'Controller', 'Controller');

        return $result;
    }

    /**
     * Get full type capability identifier.
     *
     * @return string
     */
    public static function getTypeFull()
    {
        return static::CAP_TYPE_FULL;
    }

    /**
     * Get owner type capability identifier.
     *
     * @return string
     */
    public static function getTypeOwner()
    {
        return static::CAP_TYPE_OWNER;
    }

    /**
     * Get parent type capability identifier.
     *
     * @return string
     */
    public static function getTypeParent()
    {
        return static::CAP_TYPE_PARENT;
    }

    /**
     * Method that retrieves and returns Controller public methods.
     *
{'fraction_non_alphanumeric': 0.11357900050479555, 'fraction_numerical': 0.0010095911155981827, 'mean_word_length': 2.152744630071599, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '618360', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1121, 'n_words': 297}