Beispiel #1
0
 /**
  * @param $frequency                         
  * @param SshSession $session    A shared SSH connection
  * @param $command               Command to execute on the remote host
  * @param $expression            A conditional expression respecting Symfony's ExpressionLanguage syntax.
  *                               User has access to 3 variables: stdout, stderr and status.
  */
 public function __construct($frequency, SshSession $session, $command, $expression = 'status == 0')
 {
     parent::__construct($frequency);
     $this->session = $session;
     $this->command = $command;
     $this->expression = $expression;
 }
Beispiel #2
0
 public function __construct($frequency, $host)
 {
     if (!class_exists('JJG\\Ping')) {
         trigger_error('NetworkPing requires "geerlingguy/ping" package installed', E_USER_ERROR);
     }
     parent::__construct($frequency);
     $this->ping = new Ping($host);
     $this->method = self::METHOD_SYSTEM_PING;
     // Decrease default timeout
     $this->ping->setTimeout(3);
 }
Beispiel #3
0
 /**
  * @param $frequency       The request frequency
  * @param $method          The request method
  * @param $uri             The URI to fetch
  * @param $expression      A user expression to check if response is valid or not
  * @param $parameters      The Request parameters
  * @param $files           The files
  * @param $server          The server parameters (HTTP headers are referenced with a HTTP_ prefix as PHP does)
  * @param $content         The raw body data
  */
 public function __construct($frequency, $method, $uri, $expression, array $parameters = [], array $files = [], array $server = [], $content = null)
 {
     if (!class_exists('Goutte\\Client')) {
         trigger_error('WebScraperPing requires "fabpot/goutte" package installed', E_USER_ERROR);
     }
     parent::__construct($frequency);
     $this->method = $method;
     $this->uri = $uri;
     $this->expression = $expression;
     $this->parameters = array_merge(['timeout' => 3], $parameters);
     $this->files = $files;
     $this->server = $server;
     $this->content = $content;
     $this->expression = $expression;
     $this->client = new Client();
 }