Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/captainhook/captainhook/src/Hook/Message/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/captainhook/captainhook/src/Hook/Message/RuleBook.php
<?php

/**
 * This file is part of CaptainHook
 *
 * (c) Sebastian Feldmann <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace CaptainHook\App\Hook\Message;

use SebastianFeldmann\Git\CommitMessage;

/**
 * Class RuleBook
 *
 * @package CaptainHook
 * @author  Sebastian Feldmann <[email protected]>
 * @link    https://github.com/captainhookphp/captainhook
 * @since   Class available since Release 0.9.0
 */
class RuleBook
{
    /**
     * List of rules to check
     *
     * @var \CaptainHook\App\Hook\Message\Rule[]
     */
    private $rules = [];

    /**
     * Set rules to check
     *
     * @param  \CaptainHook\App\Hook\Message\Rule[] $rules
     * @return \CaptainHook\App\Hook\Message\RuleBook
     */
    public function setRules(array $rules): RuleBook
    {
        $this->rules = $rules;
        return $this;
    }

    /**
     * Add a rule to the list
     *
     * @param  \CaptainHook\App\Hook\Message\Rule $rule
     * @return \CaptainHook\App\Hook\Message\RuleBook
     */
    public function addRule(Rule $rule): RuleBook
    {
        $this->rules[] = $rule;
        return $this;
    }

    /**
     * Validates all rules
     *
     * Returns a list of problems found checking the commit message.
     * If the list is empty the message is valid.
     *
     * @param  \SebastianFeldmann\Git\CommitMessage $msg
     * @return array<string>
     */
    public function validate(CommitMessage $msg): array
    {
        $problems = [];
        foreach ($this->rules as $rule) {
            if (!$rule->pass($msg)) {
                $problems[] = $rule->getHint();
            }
        }
        return $problems;
    }
}

Spamworldpro Mini