PluginProbe
ManageWP Worker / 4.9.25
ManageWP Worker v4.9.25
4.9.38 4.9.37 4.9.36 4.9.35 4.9.34 3.8.7 3.8.8 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.18 3.9.19 3.9.2 3.9.20 3.9.21 3.9.22 3.9.23 3.9.24 All 73 releases
worker / src / Symfony / Process / Exception / ProcessTimedOutException.php

ProcessTimedOutException.php in ManageWP Worker 4.9.25, at src/Symfony/Process/Exception/ProcessTimedOutException.php

66 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 /**
13 * Exception that is thrown when a process times out.
14 *
15 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
16 */
17 class Symfony_Process_Exception_ProcessTimedOutException extends Symfony_Process_Exception_RuntimeException
18 {
19 const TYPE_GENERAL = 1;
20 const TYPE_IDLE = 2;
21
22 private $process;
23 private $timeoutType;
24
25 public function __construct(Symfony_Process_Process $process, $timeoutType)
26 {
27 $this->process = $process;
28 $this->timeoutType = $timeoutType;
29
30 parent::__construct(sprintf(
31 'The process "%s" exceeded the timeout of %s seconds.',
32 $process->getCommandLine(),
33 $this->getExceededTimeout()
34 ));
35 }
36
37 public function getProcess()
38 {
39 return $this->process;
40 }
41
42 public function isGeneralTimeout()
43 {
44 return $this->timeoutType === self::TYPE_GENERAL;
45 }
46
47 public function isIdleTimeout()
48 {
49 return $this->timeoutType === self::TYPE_IDLE;
50 }
51
52 public function getExceededTimeout()
53 {
54 switch ($this->timeoutType) {
55 case self::TYPE_GENERAL:
56 return $this->process->getTimeout();
57
58 case self::TYPE_IDLE:
59 return $this->process->getIdleTimeout();
60
61 default:
62 throw new Symfony_Process_Exception_LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
63 }
64 }
65 }
66