Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/monara/public_html/test.athavaneng.com/themes.php on line 99
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
.
/**
* Moodle-specific common functions for named selectors.
*
* @package core
* @category test
* @copyright 2019 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Common functions for named selectors.
*
* This has to be a trait, because we need this in both the classes
* behat_exact_named_selector and behat_partial_named_selector, and
* those classes have to be subclasses of \Behat\Mink\Selector\ExactNamedSelector
* and \Behat\Mink\Selector\PartialNamedSelector. This trait is a way achieve
* that without duplciated code.
*
* @package core
* @category test
* @copyright 2019 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
trait behat_named_selector {
/**
* Registers new XPath selector with specified name.
*
* @param string $component
* @param behat_component_named_selector $selector
*/
public function register_component_selector(string $component, behat_component_named_selector $selector) {
$alias = $selector->get_alias($component);
$name = $selector->get_name($component);
static::$allowedselectors[$alias] = $name;
if ($selector->is_text_selector()) {
static::$allowedtextselectors[$alias] = $name;
}
// We must use Reflection here. The replacements property is private and cannot be accessed otherwise.
// This is due to an API limitation in Mink.
$rc = new \ReflectionClass(\Behat\Mink\Selector\NamedSelector::class);
$r = $rc->getProperty('replacements');
$r->setAccessible(true);
$replacements = $r->getValue($this);
$selectorxpath = strtr($selector->get_combined_xpath(), $replacements);
parent::registerNamedXpath($name, $selectorxpath);
}
/**
* Registers new XPath selector with specified name.
*
* @param string $component
* @param behat_component_named_replacement $replacement
*/
public function register_replacement(string $component, behat_component_named_replacement $replacement) {
// We must use Reflection here. The replacements property is private and cannot be accessed otherwise.
// This is due to an API limitation in Mink.
$rc = new \ReflectionClass(\Behat\Mink\Selector\NamedSelector::class);
$r = $rc->getProperty('replacements');
$r->setAccessible(true);
$existing = $r->getValue($this);
$from = $replacement->get_from($component);
if (isset($existing[$from])) {
throw new \coding_exception("A named replacement already exists in the partial named selector for '{$from}'. " .
"Replacement names must be unique, and should be namespaced to the component");
}
$translatedto = strtr($replacement->get_to(), $existing);
$this->registerReplacement($from, $translatedto);
}
/**
* Check whether the specified selector has been deprecated and marked for replacement.
*
* @param string $selector
* @return bool
*/
public static function is_deprecated_selector(string $selector): bool {
return array_key_exists($selector, static::$deprecatedselectors);
}
/**
* Fetch the replacement name of a deprecated selector.
*
* @param string $selector
* @return bool
*/
public static function get_deprecated_replacement(string $selector): ?string {
return static::$deprecatedselectors[$selector];
}
}