<commit_before><?php

/**
 * Linna Framework.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2017, <NAME>
 * @license http://opensource.org/licenses/MIT MIT License
 */
declare(strict_types=1);

namespace Linna\Auth;

use Linna\DataMapper\DomainObjectInterface;
use Linna\DataMapper\MapperInterface;

/**
 * Permission Mapper Interface
 * Contain methods required from concrete Permission Mapper.
 */
interface PermissionMapperInterface extends MapperInterface
{
    /**
     * Fetch a premission by name.
     * From permission name as argument, this method must return an instance
     * of Permission class or an instance of NullDomainObject class.
     *
     * @param string $permissionName
     *
     * @return DomainObjectInterface
     */
    public function fetchByName(string $permissionName) : DomainObjectInterface;

    /**
     * Fetch permissions for a role
     * From role id as argument, this method must return an array containing
     * a Permission object instance for every permission owned by the
     * given role.
     *
     * @param int $roleId
     *
     * @return array
     */
    public function fetchPermissionsByRole(int $roleId) : array;

    /**
     * Fetch permissions for a user
     * From user id as argument, this method must return an array containing
     * a Permission object instance for every permission owned by the
     * given user.
     *
     * @param int $userId
     *
     * @return array
     */
    public function fetchPermissionsByUser(int $userId) : array;

    /**
     * Combine al users-roles-permissions in storage
     * Return an array containing a sha256 hash of
     * user_id.permission_id string.
     *
     * Example
     * Hash will be match with below code sample
     *      <?php
     *      $hash = hash('sha256', $userId.'.'.$permission->getId());
     *
     * @return array
     */
    public function generatePermissionHashTable() : array;

    /**
     * Check if a permission exist.
     *
     * @param string $permission
     *
     * @return bool
     */
    public function permissionExist(string $permission) : bool;
}<commit_msg>generatePermissionHashTable() name changed<commit_after><?php

/**
 * Linna Framework.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2017, <NAME>
 * @license http://opensource.org/licenses/MIT MIT License
 */
declare(strict_types=1);

namespace Linna\Auth;

use Linna\DataMapper\DomainObjectInterface;
use Linna\DataMapper\MapperInterface;

/**
 * Permission Mapper Interface
 * Contain methods required from concrete Permission Mapper.
 */
interface PermissionMapperInterface extends MapperInterface
{
    /**
     * Fetch a premission by name.
     * From permission name as argument, this method must return an instance
     * of Permission class or an instance of NullDomainObject class.
     *
     * @param string $permissionName
     *
     * @return DomainObjectInterface
     */
    public function fetchByName(string $permissionName) : DomainObjectInterface;

    /**
     * Fetch permissions for a role
     * From role id as argument, this method must return an array containing
     * a Permission object instance for every permission owned by the
     * given role.
     *
     * @param int $roleId
     *
     * @return array
     */
    public function fetchPermissionsByRole(int $roleId) : array;

    /**
     * Fetch permissions for a user
     * From user id as argument, this method must return an array containing
     * a Permission object instance for every permission owned by the
     * given user.
     *
     * @param int $userId
     *
     * @return array
     */
    public function fetchPermissionsByUser(int $userId) : array;

    /**
     * Combine al users-roles-permissions in storage
     * Return an array containing a sha256 hash of
     * user_id.permission_id string.
     *
     * Example
     * Hash will be match with below code sample
     *      <?php
     *      $hash = hash('sha256', $userId.'.'.$permissionId);
     * @param int $userId
     * 
     * @return array
     */
    public function fetchUserPermissionHashTable(int $userId) : array;

    /**
     * Check if a permission exist.
     *
     * @param string $permission
     *
     * @return bool
     */
    public function permissionExist(string $permission) : bool;
}
{'fraction_non_alphanumeric': 0.089198606271777, 'fraction_numerical': 0.005110336817653891, 'mean_word_length': 2.6460626587637597, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 12, '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': '5537765', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1152, 'n_words': 400}