| Total Complexity | 7 |
| Total Lines | 78 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class JQueryPlugin extends ResponsePlugin |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @const The plugin name |
||
| 11 | */ |
||
| 12 | const NAME = 'jquery'; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $jQueryNs; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * True if the next selector is a command |
||
| 21 | * |
||
| 22 | * @var bool |
||
| 23 | */ |
||
| 24 | protected $bCommand = true; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * The class constructor |
||
| 28 | * |
||
| 29 | * @param string $jQueryNs |
||
| 30 | */ |
||
| 31 | public function __construct(string $jQueryNs) |
||
| 32 | { |
||
| 33 | $this->jQueryNs = $jQueryNs; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param bool $bCommand |
||
| 38 | * |
||
| 39 | * @return JQueryPlugin |
||
| 40 | */ |
||
| 41 | public function command(bool $bCommand): JQueryPlugin |
||
| 42 | { |
||
| 43 | $this->bCommand = $bCommand; |
||
| 44 | return $this; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @inheritDoc |
||
| 49 | */ |
||
| 50 | public function getName(): string |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @inheritDoc |
||
| 57 | */ |
||
| 58 | public function getHash(): string |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Create a JQueryPlugin DomSelector, and link it to the current response. |
||
| 66 | * |
||
| 67 | * Since this element is linked to a response, its code will be automatically sent to the client. |
||
| 68 | * The returned object can be used to call jQuery functions on the selected elements. |
||
| 69 | * |
||
| 70 | * @param string $sPath The jQuery selector path |
||
| 71 | * @param mixed $xContext A context associated to the selector |
||
| 72 | * |
||
| 73 | * @return DomSelector |
||
| 74 | */ |
||
| 75 | public function selector(string $sPath = '', $xContext = null): DomSelector |
||
| 87 |