X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FHook%2FCall%2FRuntimeFeatureHook.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FHook%2FCall%2FRuntimeFeatureHook.php;h=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=b3d4fb24b370b928b8845f547d36efd765b2fd03;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php b/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php deleted file mode 100644 index b3d4fb24b..000000000 --- a/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Call; - -use Behat\Behat\Hook\Scope\FeatureScope; -use Behat\Gherkin\Filter\NameFilter; -use Behat\Gherkin\Filter\TagFilter; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Call\Exception\BadCallbackException; -use Behat\Testwork\Hook\Call\RuntimeFilterableHook; -use Behat\Testwork\Hook\Scope\HookScope; - -/** - * Represents a feature hook. - * - * @author Konstantin Kudryashov - */ -abstract class RuntimeFeatureHook extends RuntimeFilterableHook -{ - /** - * Initializes hook. - * - * @param string $scopeName - * @param null|string $filterString - * @param callable $callable - * @param null|string $description - * - * @throws BadCallbackException If callback is method, but not a static one - */ - public function __construct($scopeName, $filterString, $callable, $description = null) - { - parent::__construct($scopeName, $filterString, $callable, $description); - - if ($this->isAnInstanceMethod()) { - throw new BadCallbackException(sprintf( - 'Feature hook callback: %s::%s() must be a static method', - $callable[0], - $callable[1] - ), $callable); - } - } - - /** - * {@inheritdoc} - */ - public function filterMatches(HookScope $scope) - { - if (!$scope instanceof FeatureScope) { - return false; - } - - if (null === ($filterString = $this->getFilterString())) { - return true; - } - - return $this->isMatch($scope->getFeature(), $filterString); - } - - /** - * @param FeatureNode $feature - * @param string $filterString - * - * @return Boolean - */ - private function isMatch(FeatureNode $feature, $filterString) - { - if (false !== strpos($filterString, '@')) { - return $this->isMatchTagFilter($feature, $filterString); - } - - if (!empty($filterString)) { - return $this->isMatchNameFilter($feature, $filterString); - } - - return false; - } - - /** - * Checks if feature matches tag filter. - * - * @param FeatureNode $feature - * @param string $filterString - * - * @return Boolean - */ - private function isMatchTagFilter(FeatureNode $feature, $filterString) - { - $filter = new TagFilter($filterString); - - return $filter->isFeatureMatch($feature); - } - - /** - * Checks if feature matches name filter. - * - * @param FeatureNode $feature - * @param string $filterString - * - * @return Boolean - */ - private function isMatchNameFilter(FeatureNode $feature, $filterString) - { - $filter = new NameFilter($filterString); - - return $filter->isFeatureMatch($feature); - } -}