@@ -12,50 +12,50 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | const TYPE_SCRIPT_START = 'start'; |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * @var ConvertHelper_ThrowableInfo |
|
| 17 | - */ |
|
| 15 | + /** |
|
| 16 | + * @var ConvertHelper_ThrowableInfo |
|
| 17 | + */ |
|
| 18 | 18 | protected $info; |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var array |
|
| 22 | - */ |
|
| 20 | + /** |
|
| 21 | + * @var array |
|
| 22 | + */ |
|
| 23 | 23 | protected $trace; |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var VariableInfo[] |
|
| 27 | - */ |
|
| 25 | + /** |
|
| 26 | + * @var VariableInfo[] |
|
| 27 | + */ |
|
| 28 | 28 | protected $args = array(); |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * The source file, if any |
|
| 32 | - * @var string |
|
| 33 | - */ |
|
| 30 | + /** |
|
| 31 | + * The source file, if any |
|
| 32 | + * @var string |
|
| 33 | + */ |
|
| 34 | 34 | protected $file = ''; |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @var string |
|
| 38 | - */ |
|
| 36 | + /** |
|
| 37 | + * @var string |
|
| 38 | + */ |
|
| 39 | 39 | protected $class = ''; |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @var integer |
|
| 43 | - */ |
|
| 41 | + /** |
|
| 42 | + * @var integer |
|
| 43 | + */ |
|
| 44 | 44 | protected $line = 0; |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * @var int |
|
| 48 | - */ |
|
| 46 | + /** |
|
| 47 | + * @var int |
|
| 48 | + */ |
|
| 49 | 49 | protected $position = 1; |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @var string |
|
| 53 | - */ |
|
| 51 | + /** |
|
| 52 | + * @var string |
|
| 53 | + */ |
|
| 54 | 54 | protected $function = ''; |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @var string |
|
| 58 | - */ |
|
| 56 | + /** |
|
| 57 | + * @var string |
|
| 58 | + */ |
|
| 59 | 59 | protected $type = self::TYPE_SCRIPT_START; |
| 60 | 60 | |
| 61 | 61 | protected function __construct(ConvertHelper_ThrowableInfo $info, array $data) |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * 1-based position of the call in the calls list. |
|
| 87 | - * @return int |
|
| 88 | - */ |
|
| 85 | + /** |
|
| 86 | + * 1-based position of the call in the calls list. |
|
| 87 | + * @return int |
|
| 88 | + */ |
|
| 89 | 89 | public function getPosition() : int |
| 90 | 90 | { |
| 91 | 91 | return $this->position; |
@@ -96,18 +96,18 @@ discard block |
||
| 96 | 96 | return $this->line; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * Whether the call had any arguments. |
|
| 101 | - * @return bool |
|
| 102 | - */ |
|
| 99 | + /** |
|
| 100 | + * Whether the call had any arguments. |
|
| 101 | + * @return bool |
|
| 102 | + */ |
|
| 103 | 103 | public function hasArguments() : bool |
| 104 | 104 | { |
| 105 | 105 | return !empty($this->args); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * @return VariableInfo[] |
|
| 110 | - */ |
|
| 108 | + /** |
|
| 109 | + * @return VariableInfo[] |
|
| 110 | + */ |
|
| 111 | 111 | public function getArguments() |
| 112 | 112 | { |
| 113 | 113 | return $this->args; |
@@ -240,31 +240,31 @@ discard block |
||
| 240 | 240 | return implode(', ', $tokens); |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - /** |
|
| 244 | - * Retrieves the type of call: typcially a function |
|
| 245 | - * call, or a method call of an object. Note that the |
|
| 246 | - * first call in a script does not have either. |
|
| 247 | - * |
|
| 248 | - * @return string |
|
| 249 | - * |
|
| 250 | - * @see ConvertHelper_ThrowableInfo_Call::TYPE_FUNCTION_CALL |
|
| 251 | - * @see ConvertHelper_ThrowableInfo_Call::TYPE_METHOD_CALL |
|
| 252 | - * @see ConvertHelper_ThrowableInfo_Call::TYPE_SCRIPT_START |
|
| 253 | - * @see ConvertHelper_ThrowableInfo_Call::hasFunction() |
|
| 254 | - * @see ConvertHelper_ThrowableInfo_Call::hasClass() |
|
| 255 | - */ |
|
| 243 | + /** |
|
| 244 | + * Retrieves the type of call: typcially a function |
|
| 245 | + * call, or a method call of an object. Note that the |
|
| 246 | + * first call in a script does not have either. |
|
| 247 | + * |
|
| 248 | + * @return string |
|
| 249 | + * |
|
| 250 | + * @see ConvertHelper_ThrowableInfo_Call::TYPE_FUNCTION_CALL |
|
| 251 | + * @see ConvertHelper_ThrowableInfo_Call::TYPE_METHOD_CALL |
|
| 252 | + * @see ConvertHelper_ThrowableInfo_Call::TYPE_SCRIPT_START |
|
| 253 | + * @see ConvertHelper_ThrowableInfo_Call::hasFunction() |
|
| 254 | + * @see ConvertHelper_ThrowableInfo_Call::hasClass() |
|
| 255 | + */ |
|
| 256 | 256 | public function getType() : string |
| 257 | 257 | { |
| 258 | 258 | return $this->type; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - /** |
|
| 262 | - * Serializes the call to an array, with all |
|
| 263 | - * necessary information. Can be used to restore |
|
| 264 | - * the call later using {@link ConvertHelper_ThrowableInfo_Call::fromSerialized()}. |
|
| 265 | - * |
|
| 266 | - * @return array |
|
| 267 | - */ |
|
| 261 | + /** |
|
| 262 | + * Serializes the call to an array, with all |
|
| 263 | + * necessary information. Can be used to restore |
|
| 264 | + * the call later using {@link ConvertHelper_ThrowableInfo_Call::fromSerialized()}. |
|
| 265 | + * |
|
| 266 | + * @return array |
|
| 267 | + */ |
|
| 268 | 268 | public function serialize() : array |
| 269 | 269 | { |
| 270 | 270 | $result = array( |
@@ -33,19 +33,19 @@ |
||
| 33 | 33 | $this->match = $matchedString; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * The zero-based start position of the string in the haystack. |
|
| 38 | - * @return int |
|
| 39 | - */ |
|
| 36 | + /** |
|
| 37 | + * The zero-based start position of the string in the haystack. |
|
| 38 | + * @return int |
|
| 39 | + */ |
|
| 40 | 40 | public function getPosition() : int |
| 41 | 41 | { |
| 42 | 42 | return $this->position; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * The exact string that was matched, respecting the case as found in needle. |
|
| 47 | - * @return string |
|
| 48 | - */ |
|
| 45 | + /** |
|
| 46 | + * The exact string that was matched, respecting the case as found in needle. |
|
| 47 | + * @return string |
|
| 48 | + */ |
|
| 49 | 49 | public function getMatchedString() : string |
| 50 | 50 | { |
| 51 | 51 | return $this->match; |
@@ -6,9 +6,9 @@ |
||
| 6 | 6 | { |
| 7 | 7 | protected $xml; |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * @var \LibXMLError |
|
| 11 | - */ |
|
| 9 | + /** |
|
| 10 | + * @var \LibXMLError |
|
| 11 | + */ |
|
| 12 | 12 | protected $nativeError; |
| 13 | 13 | |
| 14 | 14 | public function __construct(XMLHelper_SimpleXML $xml, \LibXMLError $nativeError) |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | const ERROR_FAILED_CONVERTING_TO_JSON = 37901; |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @var \SimpleXMLElement |
|
| 46 | - */ |
|
| 44 | + /** |
|
| 45 | + * @var \SimpleXMLElement |
|
| 46 | + */ |
|
| 47 | 47 | protected $xml; |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @var string |
|
| 51 | - */ |
|
| 49 | + /** |
|
| 50 | + * @var string |
|
| 51 | + */ |
|
| 52 | 52 | protected $json; |
| 53 | 53 | |
| 54 | 54 | protected function __construct(\SimpleXMLElement $element) |
@@ -56,24 +56,24 @@ discard block |
||
| 56 | 56 | $this->xml = $element; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Factory method: creates a converter from an XML file on disk. |
|
| 61 | - * |
|
| 62 | - * @param string $path |
|
| 63 | - * @return \AppUtils\XMLHelper_Converter |
|
| 64 | - */ |
|
| 59 | + /** |
|
| 60 | + * Factory method: creates a converter from an XML file on disk. |
|
| 61 | + * |
|
| 62 | + * @param string $path |
|
| 63 | + * @return \AppUtils\XMLHelper_Converter |
|
| 64 | + */ |
|
| 65 | 65 | public static function fromFile(string $path) |
| 66 | 66 | { |
| 67 | 67 | $xmlString = file_get_contents($path); |
| 68 | 68 | return self::fromString($xmlString); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Factory method: creates a converter from an XML string. |
|
| 73 | - * |
|
| 74 | - * @param string $xmlString |
|
| 75 | - * @return \AppUtils\XMLHelper_Converter |
|
| 76 | - */ |
|
| 71 | + /** |
|
| 72 | + * Factory method: creates a converter from an XML string. |
|
| 73 | + * |
|
| 74 | + * @param string $xmlString |
|
| 75 | + * @return \AppUtils\XMLHelper_Converter |
|
| 76 | + */ |
|
| 77 | 77 | public static function fromString(string $xmlString) |
| 78 | 78 | { |
| 79 | 79 | $element = new \SimpleXMLElement($xmlString); |
@@ -81,36 +81,36 @@ discard block |
||
| 81 | 81 | return self::fromElement($element); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * Factory method: creates a converter from an existing SimpleXMLElement instance. |
|
| 86 | - * |
|
| 87 | - * @param \SimpleXMLElement $element |
|
| 88 | - * @return \AppUtils\XMLHelper_Converter |
|
| 89 | - */ |
|
| 84 | + /** |
|
| 85 | + * Factory method: creates a converter from an existing SimpleXMLElement instance. |
|
| 86 | + * |
|
| 87 | + * @param \SimpleXMLElement $element |
|
| 88 | + * @return \AppUtils\XMLHelper_Converter |
|
| 89 | + */ |
|
| 90 | 90 | public static function fromElement(\SimpleXMLElement $element) |
| 91 | 91 | { |
| 92 | 92 | $obj = new XMLHelper_Converter($element); |
| 93 | 93 | return $obj; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Factory method: creates a converter from an existing SimpleXMLElement instance. |
|
| 98 | - * |
|
| 99 | - * @param \DOMElement $element |
|
| 100 | - * @return \AppUtils\XMLHelper_Converter |
|
| 101 | - */ |
|
| 96 | + /** |
|
| 97 | + * Factory method: creates a converter from an existing SimpleXMLElement instance. |
|
| 98 | + * |
|
| 99 | + * @param \DOMElement $element |
|
| 100 | + * @return \AppUtils\XMLHelper_Converter |
|
| 101 | + */ |
|
| 102 | 102 | public static function fromDOMElement(\DOMElement $element) |
| 103 | 103 | { |
| 104 | 104 | $obj = new XMLHelper_Converter(simplexml_import_dom($element)); |
| 105 | 105 | return $obj; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Converts the XML to JSON. |
|
| 110 | - * |
|
| 111 | - * @throws XMLHelper_Exception |
|
| 112 | - * @return string |
|
| 113 | - */ |
|
| 108 | + /** |
|
| 109 | + * Converts the XML to JSON. |
|
| 110 | + * |
|
| 111 | + * @throws XMLHelper_Exception |
|
| 112 | + * @return string |
|
| 113 | + */ |
|
| 114 | 114 | public function toJSON() : string |
| 115 | 115 | { |
| 116 | 116 | if(isset($this->json)) { |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | ); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - /** |
|
| 142 | - * Converts the XML to an associative array. |
|
| 143 | - * @return array |
|
| 144 | - * @throws XMLHelper_Exception |
|
| 145 | - */ |
|
| 141 | + /** |
|
| 142 | + * Converts the XML to an associative array. |
|
| 143 | + * @return array |
|
| 144 | + * @throws XMLHelper_Exception |
|
| 145 | + */ |
|
| 146 | 146 | public function toArray() : array |
| 147 | 147 | { |
| 148 | 148 | $json = $this->toJSON(); |
@@ -11,27 +11,27 @@ |
||
| 11 | 11 | |
| 12 | 12 | protected $errors = array(); |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Creates a simplexml instance from an XML string. |
|
| 16 | - * |
|
| 17 | - * NOTE: returns false in case of a fatal error. |
|
| 18 | - * |
|
| 19 | - * @param string $string |
|
| 20 | - * @return \SimpleXMLElement|bool |
|
| 21 | - */ |
|
| 14 | + /** |
|
| 15 | + * Creates a simplexml instance from an XML string. |
|
| 16 | + * |
|
| 17 | + * NOTE: returns false in case of a fatal error. |
|
| 18 | + * |
|
| 19 | + * @param string $string |
|
| 20 | + * @return \SimpleXMLElement|bool |
|
| 21 | + */ |
|
| 22 | 22 | public function loadString($string) |
| 23 | 23 | { |
| 24 | 24 | return $this->load('string', $string); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Creates a simplexml instance from an XML file. |
|
| 29 | - * |
|
| 30 | - * NOTE: returns false in case of a fatal error. |
|
| 31 | - * |
|
| 32 | - * @param string $file |
|
| 33 | - * @return \SimpleXMLElement|bool |
|
| 34 | - */ |
|
| 27 | + /** |
|
| 28 | + * Creates a simplexml instance from an XML file. |
|
| 29 | + * |
|
| 30 | + * NOTE: returns false in case of a fatal error. |
|
| 31 | + * |
|
| 32 | + * @param string $file |
|
| 33 | + * @return \SimpleXMLElement|bool |
|
| 34 | + */ |
|
| 35 | 35 | public function loadFile($file) |
| 36 | 36 | { |
| 37 | 37 | return $this->load('file', $file); |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | const REGEX_MD5 = '/^[a-f0-9]{32}$/i'; |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var string |
|
| 47 | - * @see https://en.wikipedia.org/wiki/Email_address#Local-part |
|
| 48 | - */ |
|
| 45 | + /** |
|
| 46 | + * @var string |
|
| 47 | + * @see https://en.wikipedia.org/wiki/Email_address#Local-part |
|
| 48 | + */ |
|
| 49 | 49 | const REGEX_EMAIL = '/[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i'; |
| 50 | 50 | |
| 51 | 51 | const REGEX_PHONE = '/\A[+0-9][0-9 +\-()]+\z/m'; |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | const REGEX_IS_HTML = '%<{0,1}[a-z\/][\s\S]*>|<[a-z\/][\s\S]*>{0,1}%i'; |
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Hexadecimal color codes. Allows the following formats: |
|
| 102 | - * |
|
| 103 | - * FFFFFF |
|
| 104 | - * FFF |
|
| 105 | - * |
|
| 106 | - * @var string |
|
| 107 | - */ |
|
| 100 | + /** |
|
| 101 | + * Hexadecimal color codes. Allows the following formats: |
|
| 102 | + * |
|
| 103 | + * FFFFFF |
|
| 104 | + * FFF |
|
| 105 | + * |
|
| 106 | + * @var string |
|
| 107 | + */ |
|
| 108 | 108 | const REGEX_HEX_COLOR_CODE = '/\A(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{3})\z/iU'; |
| 109 | 109 | } |
@@ -38,38 +38,38 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | protected $text; |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @var string |
|
| 43 | - */ |
|
| 41 | + /** |
|
| 42 | + * @var string |
|
| 43 | + */ |
|
| 44 | 44 | protected $trimmed; |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * @var int |
|
| 48 | - */ |
|
| 46 | + /** |
|
| 47 | + * @var int |
|
| 48 | + */ |
|
| 49 | 49 | protected $lineNumber; |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @var string |
|
| 53 | - */ |
|
| 51 | + /** |
|
| 52 | + * @var string |
|
| 53 | + */ |
|
| 54 | 54 | protected $type; |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @var string |
|
| 58 | - */ |
|
| 56 | + /** |
|
| 57 | + * @var string |
|
| 58 | + */ |
|
| 59 | 59 | protected $varName = ''; |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @var string |
|
| 63 | - */ |
|
| 61 | + /** |
|
| 62 | + * @var string |
|
| 63 | + */ |
|
| 64 | 64 | protected $varValue = ''; |
| 65 | 65 | |
| 66 | 66 | protected $valueUnquoted = ''; |
| 67 | 67 | |
| 68 | 68 | protected $quoteStyle = ''; |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @var string |
|
| 72 | - */ |
|
| 70 | + /** |
|
| 71 | + * @var string |
|
| 72 | + */ |
|
| 73 | 73 | protected $sectionName = ''; |
| 74 | 74 | |
| 75 | 75 | public function __construct(string $text, int $lineNumber) |
@@ -21,19 +21,19 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | class IniHelper_Section |
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * @var IniHelper |
|
| 26 | - */ |
|
| 24 | + /** |
|
| 25 | + * @var IniHelper |
|
| 26 | + */ |
|
| 27 | 27 | protected $ini; |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @var string |
|
| 31 | - */ |
|
| 29 | + /** |
|
| 30 | + * @var string |
|
| 31 | + */ |
|
| 32 | 32 | protected $name; |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @var IniHelper_Line[] |
|
| 36 | - */ |
|
| 34 | + /** |
|
| 35 | + * @var IniHelper_Line[] |
|
| 36 | + */ |
|
| 37 | 37 | protected $lines = array(); |
| 38 | 38 | |
| 39 | 39 | public function __construct(IniHelper $ini, string $name) |
@@ -42,33 +42,33 @@ discard block |
||
| 42 | 42 | $this->name = $name; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * The section's name. |
|
| 47 | - * @return string |
|
| 48 | - */ |
|
| 45 | + /** |
|
| 46 | + * The section's name. |
|
| 47 | + * @return string |
|
| 48 | + */ |
|
| 49 | 49 | public function getName() : string |
| 50 | 50 | { |
| 51 | 51 | return $this->name; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Whether this is the default section: this |
|
| 56 | - * is used internally to store all variables that |
|
| 57 | - * are not in any specific section. |
|
| 58 | - * |
|
| 59 | - * @return bool |
|
| 60 | - */ |
|
| 54 | + /** |
|
| 55 | + * Whether this is the default section: this |
|
| 56 | + * is used internally to store all variables that |
|
| 57 | + * are not in any specific section. |
|
| 58 | + * |
|
| 59 | + * @return bool |
|
| 60 | + */ |
|
| 61 | 61 | public function isDefault() : bool |
| 62 | 62 | { |
| 63 | 63 | return $this->name === IniHelper::SECTION_DEFAULT; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Adds a line instance to the section. |
|
| 68 | - * |
|
| 69 | - * @param IniHelper_Line $line |
|
| 70 | - * @return IniHelper_Section |
|
| 71 | - */ |
|
| 66 | + /** |
|
| 67 | + * Adds a line instance to the section. |
|
| 68 | + * |
|
| 69 | + * @param IniHelper_Line $line |
|
| 70 | + * @return IniHelper_Section |
|
| 71 | + */ |
|
| 72 | 72 | public function addLine(IniHelper_Line $line) : IniHelper_Section |
| 73 | 73 | { |
| 74 | 74 | $this->lines[] = $line; |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | return $this; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Converts the values contained in the section into |
|
| 81 | - * an associative array. |
|
| 82 | - * |
|
| 83 | - * @return array |
|
| 84 | - */ |
|
| 79 | + /** |
|
| 80 | + * Converts the values contained in the section into |
|
| 81 | + * an associative array. |
|
| 82 | + * |
|
| 83 | + * @return array |
|
| 84 | + */ |
|
| 85 | 85 | public function toArray() : array |
| 86 | 86 | { |
| 87 | 87 | $result = array(); |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | return $result; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * Converts the section's lines into an INI string. |
|
| 119 | - * |
|
| 120 | - * @return string |
|
| 121 | - */ |
|
| 117 | + /** |
|
| 118 | + * Converts the section's lines into an INI string. |
|
| 119 | + * |
|
| 120 | + * @return string |
|
| 121 | + */ |
|
| 122 | 122 | public function toString() |
| 123 | 123 | { |
| 124 | 124 | $lines = array(); |
@@ -140,12 +140,12 @@ discard block |
||
| 140 | 140 | return implode($this->ini->getEOLChar(), $lines); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - /** |
|
| 144 | - * Deletes a line from the section. |
|
| 145 | - * |
|
| 146 | - * @param IniHelper_Line $toDelete |
|
| 147 | - * @return IniHelper_Section |
|
| 148 | - */ |
|
| 143 | + /** |
|
| 144 | + * Deletes a line from the section. |
|
| 145 | + * |
|
| 146 | + * @param IniHelper_Line $toDelete |
|
| 147 | + * @return IniHelper_Section |
|
| 148 | + */ |
|
| 149 | 149 | public function deleteLine(IniHelper_Line $toDelete) : IniHelper_Section |
| 150 | 150 | { |
| 151 | 151 | $keep = array(); |
@@ -162,13 +162,13 @@ discard block |
||
| 162 | 162 | return $this; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - /** |
|
| 166 | - * Sets the value of a variable, overwriting any existing value. |
|
| 167 | - * |
|
| 168 | - * @param string $name |
|
| 169 | - * @param mixed $value If an array is specified, it is treated as duplicate keys and will add a line for each value. |
|
| 170 | - * @return IniHelper_Section |
|
| 171 | - */ |
|
| 165 | + /** |
|
| 166 | + * Sets the value of a variable, overwriting any existing value. |
|
| 167 | + * |
|
| 168 | + * @param string $name |
|
| 169 | + * @param mixed $value If an array is specified, it is treated as duplicate keys and will add a line for each value. |
|
| 170 | + * @return IniHelper_Section |
|
| 171 | + */ |
|
| 172 | 172 | public function setValue(string $name, $value) : IniHelper_Section |
| 173 | 173 | { |
| 174 | 174 | $lines = $this->getLinesByVariable($name); |
@@ -229,15 +229,15 @@ discard block |
||
| 229 | 229 | return $this; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - /** |
|
| 233 | - * Adds a variable value to the section. Unlike setValue(), this |
|
| 234 | - * will not overwrite any existing value. If the name is an existing |
|
| 235 | - * variable name, it will be converted to duplicate keys. |
|
| 236 | - * |
|
| 237 | - * @param string $name |
|
| 238 | - * @param mixed $value If this is an array, it will be treated as duplicate keys, and all values that are not present yet will be added. |
|
| 239 | - * @return IniHelper_Section |
|
| 240 | - */ |
|
| 232 | + /** |
|
| 233 | + * Adds a variable value to the section. Unlike setValue(), this |
|
| 234 | + * will not overwrite any existing value. If the name is an existing |
|
| 235 | + * variable name, it will be converted to duplicate keys. |
|
| 236 | + * |
|
| 237 | + * @param string $name |
|
| 238 | + * @param mixed $value If this is an array, it will be treated as duplicate keys, and all values that are not present yet will be added. |
|
| 239 | + * @return IniHelper_Section |
|
| 240 | + */ |
|
| 241 | 241 | public function addValue(string $name, $value) : IniHelper_Section |
| 242 | 242 | { |
| 243 | 243 | // array value? Treat it as duplicate keys. |
@@ -295,12 +295,12 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | |
| 298 | - /** |
|
| 299 | - * Retrieves all lines for the specified variable name. |
|
| 300 | - * |
|
| 301 | - * @param string $name |
|
| 302 | - * @return \AppUtils\IniHelper_Line[] |
|
| 303 | - */ |
|
| 298 | + /** |
|
| 299 | + * Retrieves all lines for the specified variable name. |
|
| 300 | + * |
|
| 301 | + * @param string $name |
|
| 302 | + * @return \AppUtils\IniHelper_Line[] |
|
| 303 | + */ |
|
| 304 | 304 | public function getLinesByVariable(string $name) |
| 305 | 305 | { |
| 306 | 306 | $result = array(); |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | protected $file; |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @var \ZipArchive |
|
| 43 | - */ |
|
| 41 | + /** |
|
| 42 | + * @var \ZipArchive |
|
| 43 | + */ |
|
| 44 | 44 | protected $zip; |
| 45 | 45 | |
| 46 | 46 | public function __construct($targetFile) |
@@ -48,33 +48,33 @@ discard block |
||
| 48 | 48 | $this->file = $targetFile; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Sets an option, among the available options: |
|
| 53 | - * |
|
| 54 | - * <ul> |
|
| 55 | - * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li> |
|
| 56 | - * </ul> |
|
| 57 | - * |
|
| 58 | - * @param string $name |
|
| 59 | - * @param mixed $value |
|
| 60 | - * @return ZIPHelper |
|
| 61 | - */ |
|
| 51 | + /** |
|
| 52 | + * Sets an option, among the available options: |
|
| 53 | + * |
|
| 54 | + * <ul> |
|
| 55 | + * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li> |
|
| 56 | + * </ul> |
|
| 57 | + * |
|
| 58 | + * @param string $name |
|
| 59 | + * @param mixed $value |
|
| 60 | + * @return ZIPHelper |
|
| 61 | + */ |
|
| 62 | 62 | public function setOption($name, $value) |
| 63 | 63 | { |
| 64 | 64 | $this->options[$name] = $value; |
| 65 | 65 | return $this; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Adds a file to the zip. By default, the file is stored |
|
| 70 | - * with the same name in the root of the zip. Use the optional |
|
| 71 | - * parameter to change the location in the zip. |
|
| 72 | - * |
|
| 73 | - * @param string $filePath |
|
| 74 | - * @param string $zipPath |
|
| 75 | - * @throws ZIPHelper_Exception |
|
| 76 | - * @return bool |
|
| 77 | - */ |
|
| 68 | + /** |
|
| 69 | + * Adds a file to the zip. By default, the file is stored |
|
| 70 | + * with the same name in the root of the zip. Use the optional |
|
| 71 | + * parameter to change the location in the zip. |
|
| 72 | + * |
|
| 73 | + * @param string $filePath |
|
| 74 | + * @param string $zipPath |
|
| 75 | + * @throws ZIPHelper_Exception |
|
| 76 | + * @return bool |
|
| 77 | + */ |
|
| 78 | 78 | public function addFile($filePath, $zipPath=null) |
| 79 | 79 | { |
| 80 | 80 | $this->open(); |
@@ -252,13 +252,13 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | protected $exit; |
| 254 | 254 | |
| 255 | - /** |
|
| 256 | - * Like {@link ZIPHelper::download()}, but deletes the |
|
| 257 | - * file after sending it to the browser. |
|
| 258 | - * |
|
| 259 | - * @param string|NULL $fileName Override the ZIP's file name for the download |
|
| 260 | - * @see ZIPHelper::download() |
|
| 261 | - */ |
|
| 255 | + /** |
|
| 256 | + * Like {@link ZIPHelper::download()}, but deletes the |
|
| 257 | + * file after sending it to the browser. |
|
| 258 | + * |
|
| 259 | + * @param string|NULL $fileName Override the ZIP's file name for the download |
|
| 260 | + * @see ZIPHelper::download() |
|
| 261 | + */ |
|
| 262 | 262 | public function downloadAndDelete($fileName=null) |
| 263 | 263 | { |
| 264 | 264 | $this->exit = false; |
@@ -272,14 +272,14 @@ discard block |
||
| 272 | 272 | exit; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - /** |
|
| 276 | - * Extracts all files and folders from the zip to the |
|
| 277 | - * target folder. If no folder is specified, the files |
|
| 278 | - * are extracted into the same folder as the zip itself. |
|
| 279 | - * |
|
| 280 | - * @param string $outputFolder |
|
| 281 | - * @return boolean |
|
| 282 | - */ |
|
| 275 | + /** |
|
| 276 | + * Extracts all files and folders from the zip to the |
|
| 277 | + * target folder. If no folder is specified, the files |
|
| 278 | + * are extracted into the same folder as the zip itself. |
|
| 279 | + * |
|
| 280 | + * @param string $outputFolder |
|
| 281 | + * @return boolean |
|
| 282 | + */ |
|
| 283 | 283 | public function extractAll($outputFolder=null) |
| 284 | 284 | { |
| 285 | 285 | if(empty($outputFolder)) { |
@@ -292,9 +292,9 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | |
| 295 | - /** |
|
| 296 | - * @return \ZipArchive |
|
| 297 | - */ |
|
| 295 | + /** |
|
| 296 | + * @return \ZipArchive |
|
| 297 | + */ |
|
| 298 | 298 | public function getArchive() |
| 299 | 299 | { |
| 300 | 300 | $this->open(); |
@@ -302,14 +302,14 @@ discard block |
||
| 302 | 302 | return $this->zip; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - /** |
|
| 306 | - * JSON encodes the specified data and adds the json as |
|
| 307 | - * a file in the ZIP archive. |
|
| 308 | - * |
|
| 309 | - * @param mixed $data |
|
| 310 | - * @param string $zipPath |
|
| 311 | - * @return boolean |
|
| 312 | - */ |
|
| 305 | + /** |
|
| 306 | + * JSON encodes the specified data and adds the json as |
|
| 307 | + * a file in the ZIP archive. |
|
| 308 | + * |
|
| 309 | + * @param mixed $data |
|
| 310 | + * @param string $zipPath |
|
| 311 | + * @return boolean |
|
| 312 | + */ |
|
| 313 | 313 | public function addJSON($data, $zipPath) |
| 314 | 314 | { |
| 315 | 315 | return $this->addString( |