| @@ 1739-1782 (lines=44) @@ | ||
| 1736 | * @ingroup Parser |
|
| 1737 | */ |
|
| 1738 | // @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps |
|
| 1739 | class PPCustomFrame_DOM extends PPFrame_DOM { |
|
| 1740 | // @codingStandardsIgnoreEnd |
|
| 1741 | ||
| 1742 | public $args; |
|
| 1743 | ||
| 1744 | public function __construct( $preprocessor, $args ) { |
|
| 1745 | parent::__construct( $preprocessor ); |
|
| 1746 | $this->args = $args; |
|
| 1747 | } |
|
| 1748 | ||
| 1749 | public function __toString() { |
|
| 1750 | $s = 'cstmframe{'; |
|
| 1751 | $first = true; |
|
| 1752 | foreach ( $this->args as $name => $value ) { |
|
| 1753 | if ( $first ) { |
|
| 1754 | $first = false; |
|
| 1755 | } else { |
|
| 1756 | $s .= ', '; |
|
| 1757 | } |
|
| 1758 | $s .= "\"$name\":\"" . |
|
| 1759 | str_replace( '"', '\\"', $value->__toString() ) . '"'; |
|
| 1760 | } |
|
| 1761 | $s .= '}'; |
|
| 1762 | return $s; |
|
| 1763 | } |
|
| 1764 | ||
| 1765 | /** |
|
| 1766 | * @return bool |
|
| 1767 | */ |
|
| 1768 | public function isEmpty() { |
|
| 1769 | return !count( $this->args ); |
|
| 1770 | } |
|
| 1771 | ||
| 1772 | /** |
|
| 1773 | * @param int|string $index |
|
| 1774 | * @return string|bool |
|
| 1775 | */ |
|
| 1776 | public function getArgument( $index ) { |
|
| 1777 | if ( !isset( $this->args[$index] ) ) { |
|
| 1778 | return false; |
|
| 1779 | } |
|
| 1780 | return $this->args[$index]; |
|
| 1781 | } |
|
| 1782 | ||
| 1783 | public function getArguments() { |
|
| 1784 | return $this->args; |
|
| 1785 | } |
|
| @@ 1570-1617 (lines=48) @@ | ||
| 1567 | * @ingroup Parser |
|
| 1568 | */ |
|
| 1569 | // @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps |
|
| 1570 | class PPCustomFrame_Hash extends PPFrame_Hash { |
|
| 1571 | // @codingStandardsIgnoreEnd |
|
| 1572 | ||
| 1573 | public $args; |
|
| 1574 | ||
| 1575 | public function __construct( $preprocessor, $args ) { |
|
| 1576 | parent::__construct( $preprocessor ); |
|
| 1577 | $this->args = $args; |
|
| 1578 | } |
|
| 1579 | ||
| 1580 | public function __toString() { |
|
| 1581 | $s = 'cstmframe{'; |
|
| 1582 | $first = true; |
|
| 1583 | foreach ( $this->args as $name => $value ) { |
|
| 1584 | if ( $first ) { |
|
| 1585 | $first = false; |
|
| 1586 | } else { |
|
| 1587 | $s .= ', '; |
|
| 1588 | } |
|
| 1589 | $s .= "\"$name\":\"" . |
|
| 1590 | str_replace( '"', '\\"', $value->__toString() ) . '"'; |
|
| 1591 | } |
|
| 1592 | $s .= '}'; |
|
| 1593 | return $s; |
|
| 1594 | } |
|
| 1595 | ||
| 1596 | /** |
|
| 1597 | * @return bool |
|
| 1598 | */ |
|
| 1599 | public function isEmpty() { |
|
| 1600 | return !count( $this->args ); |
|
| 1601 | } |
|
| 1602 | ||
| 1603 | /** |
|
| 1604 | * @param int|string $index |
|
| 1605 | * @return string|bool |
|
| 1606 | */ |
|
| 1607 | public function getArgument( $index ) { |
|
| 1608 | if ( !isset( $this->args[$index] ) ) { |
|
| 1609 | return false; |
|
| 1610 | } |
|
| 1611 | return $this->args[$index]; |
|
| 1612 | } |
|
| 1613 | ||
| 1614 | public function getArguments() { |
|
| 1615 | return $this->args; |
|
| 1616 | } |
|
| 1617 | } |
|
| 1618 | ||
| 1619 | /** |
|
| 1620 | * @ingroup Parser |
|