Overview

Namespaces

  • Pharborist
    • Constants
    • ControlStructures
    • Exceptions
    • Functions
    • Generators
    • Namespaces
    • Objects
    • Operators
    • Types
    • Variables

Classes

  • Pharborist\Variables\CompoundVariableNode
  • Pharborist\Variables\GlobalStatementNode
  • Pharborist\Variables\ReferenceVariableNode
  • Pharborist\Variables\StaticVariableNode
  • Pharborist\Variables\StaticVariableStatementNode
  • Pharborist\Variables\VariableNode
  • Pharborist\Variables\VariableVariableNode

Interfaces

  • Pharborist\Variables\VariableExpressionNode
  • Overview
  • Namespace
  • Class
 1: <?php
 2: namespace Pharborist\Exceptions;
 3: 
 4: use Pharborist\Node;
 5: use Pharborist\StatementNode;
 6: 
 7: /**
 8:  * A try control structure.
 9:  */
10: class TryCatchNode extends StatementNode {
11:   /**
12:    * @var Node
13:    */
14:   protected $try;
15: 
16:   /**
17:    * @var Node
18:    */
19:   protected $finally;
20: 
21:   /**
22:    * @return Node
23:    */
24:   public function getTry() {
25:     return $this->try;
26:   }
27: 
28:   /**
29:    * @return CatchNode[]
30:    */
31:   public function getCatches() {
32:     return $this->childrenByInstance('\Pharborist\Exceptions\CatchNode');
33:   }
34: 
35:   /**
36:    * @return Node
37:    */
38:   public function getFinally() {
39:     return $this->finally;
40:   }
41: 
42:   /**
43:    * Returns if this try/catch has a catch for a certain exception type.
44:    *
45:    * @param string $exception ...
46:    *  At least one exception type to check for. Each should be a fully qualified
47:    *  name, e.g. `\Exception` instead of `Exception`.
48:    *
49:    * @return boolean
50:    */
51:   public function catches($exception) {
52:     $exceptions = func_get_args();
53: 
54:     foreach ($this->getCatches() as $catch) {
55:       if (in_array($catch->getExceptionType()->getAbsolutePath(), $exceptions, TRUE)) {
56:         return TRUE;
57:       }
58:     }
59:     return FALSE;
60:   }
61: }
62: 
Pharborist API documentation generated by ApiGen