| @@ -16,9 +16,9 @@ | ||
| 16 | 16 |          die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); | 
| 17 | 17 | } | 
| 18 | 18 | |
| 19 | - /** | |
| 20 | - * The composer autoloader | |
| 21 | - */ | |
| 19 | + /** | |
| 20 | + * The composer autoloader | |
| 21 | + */ | |
| 22 | 22 | require_once $autoload; | 
| 23 | 23 | |
| 24 | 24 | // the folder in which the localization .ini files are stored | 
| @@ -10,19 +10,19 @@ discard block | ||
| 10 | 10 | |
| 11 | 11 | const STORAGE_FORMAT_VERSION = 1; | 
| 12 | 12 | |
| 13 | - /** | |
| 14 | - * @var Localization_Scanner | |
| 15 | - */ | |
| 13 | + /** | |
| 14 | + * @var Localization_Scanner | |
| 15 | + */ | |
| 16 | 16 | protected $scanner; | 
| 17 | 17 | |
| 18 | - /** | |
| 19 | - * @var Localization_Scanner_StringHash[] | |
| 20 | - */ | |
| 18 | + /** | |
| 19 | + * @var Localization_Scanner_StringHash[] | |
| 20 | + */ | |
| 21 | 21 | protected $hashes = array(); | 
| 22 | 22 | |
| 23 | - /** | |
| 24 | - * @var array | |
| 25 | - */ | |
| 23 | + /** | |
| 24 | + * @var array | |
| 25 | + */ | |
| 26 | 26 | protected $warnings = array(); | 
| 27 | 27 | |
| 28 | 28 | public function __construct(Localization_Scanner $scanner) | 
| @@ -51,12 +51,12 @@ discard block | ||
| 51 | 51 | return $string; | 
| 52 | 52 | } | 
| 53 | 53 | |
| 54 | - /** | |
| 55 | - * Adds a single translateable string. | |
| 56 | - * | |
| 57 | - * @param Localization_Scanner_StringInfo $string | |
| 58 | - * @return Localization_Scanner_StringsCollection | |
| 59 | - */ | |
| 54 | + /** | |
| 55 | + * Adds a single translateable string. | |
| 56 | + * | |
| 57 | + * @param Localization_Scanner_StringInfo $string | |
| 58 | + * @return Localization_Scanner_StringsCollection | |
| 59 | + */ | |
| 60 | 60 | protected function add(Localization_Scanner_StringInfo $string) | 
| 61 | 61 |      { | 
| 62 | 62 | $hash = $string->getHash(); | 
| @@ -69,12 +69,12 @@ discard block | ||
| 69 | 69 | return $this; | 
| 70 | 70 | } | 
| 71 | 71 | |
| 72 | - /** | |
| 73 | - * Retrieves all available translateable strings, | |
| 74 | - * grouped by their hash to identify unique strings. | |
| 75 | - * | |
| 76 | - * @return Localization_Scanner_StringHash[] | |
| 77 | - */ | |
| 72 | + /** | |
| 73 | + * Retrieves all available translateable strings, | |
| 74 | + * grouped by their hash to identify unique strings. | |
| 75 | + * | |
| 76 | + * @return Localization_Scanner_StringHash[] | |
| 77 | + */ | |
| 78 | 78 | public function getHashes() | 
| 79 | 79 |      { | 
| 80 | 80 | return array_values($this->hashes); | 
| @@ -133,32 +133,32 @@ discard block | ||
| 133 | 133 | return true; | 
| 134 | 134 | } | 
| 135 | 135 | |
| 136 | - /** | |
| 137 | - * Whether the parser reported warnings during the | |
| 138 | - * search for translateable texts. | |
| 139 | - * | |
| 140 | - * @return bool | |
| 141 | - */ | |
| 136 | + /** | |
| 137 | + * Whether the parser reported warnings during the | |
| 138 | + * search for translateable texts. | |
| 139 | + * | |
| 140 | + * @return bool | |
| 141 | + */ | |
| 142 | 142 | public function hasWarnings() : bool | 
| 143 | 143 |      { | 
| 144 | 144 | return !empty($this->warnings); | 
| 145 | 145 | } | 
| 146 | 146 | |
| 147 | - /** | |
| 148 | - * Retrieves the amount of warnings. | |
| 149 | - * @return int | |
| 150 | - */ | |
| 147 | + /** | |
| 148 | + * Retrieves the amount of warnings. | |
| 149 | + * @return int | |
| 150 | + */ | |
| 151 | 151 | public function countWarnings() : int | 
| 152 | 152 |      { | 
| 153 | 153 | return count($this->warnings); | 
| 154 | 154 | } | 
| 155 | 155 | |
| 156 | - /** | |
| 157 | - * Retrieves all warning messages that were added | |
| 158 | - * during the search for translateable texts, if any. | |
| 159 | - * | |
| 160 | - * @return Localization_Scanner_StringsCollection_Warning[] | |
| 161 | - */ | |
| 156 | + /** | |
| 157 | + * Retrieves all warning messages that were added | |
| 158 | + * during the search for translateable texts, if any. | |
| 159 | + * | |
| 160 | + * @return Localization_Scanner_StringsCollection_Warning[] | |
| 161 | + */ | |
| 162 | 162 | public function getWarnings() : array | 
| 163 | 163 |      { | 
| 164 | 164 | $result = array(); | 
| @@ -185,12 +185,12 @@ discard block | ||
| 185 | 185 | return $amount; | 
| 186 | 186 | } | 
| 187 | 187 | |
| 188 | - /** | |
| 189 | - * Retrieves all string hashed for the specified source. | |
| 190 | - * | |
| 191 | - * @param string $id | |
| 192 | - * @return \AppLocalize\Localization_Scanner_StringHash[] | |
| 193 | - */ | |
| 188 | + /** | |
| 189 | + * Retrieves all string hashed for the specified source. | |
| 190 | + * | |
| 191 | + * @param string $id | |
| 192 | + * @return \AppLocalize\Localization_Scanner_StringHash[] | |
| 193 | + */ | |
| 194 | 194 | public function getHashesBySourceID(string $id) | 
| 195 | 195 |      { | 
| 196 | 196 | $hashes = array(); | 
| @@ -204,12 +204,12 @@ discard block | ||
| 204 | 204 | return $hashes; | 
| 205 | 205 | } | 
| 206 | 206 | |
| 207 | - /** | |
| 208 | - * Retrieves all hashes for the specified language ID. | |
| 209 | - * | |
| 210 | - * @param string $languageID The language ID, e.g. "PHP" | |
| 211 | - * @return \AppLocalize\Localization_Scanner_StringHash[] | |
| 212 | - */ | |
| 207 | + /** | |
| 208 | + * Retrieves all hashes for the specified language ID. | |
| 209 | + * | |
| 210 | + * @param string $languageID The language ID, e.g. "PHP" | |
| 211 | + * @return \AppLocalize\Localization_Scanner_StringHash[] | |
| 212 | + */ | |
| 213 | 213 | public function getHashesByLanguageID(string $languageID) | 
| 214 | 214 |      { | 
| 215 | 215 | $hashes = array(); | 
| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | |
| 5 | 5 | class Localization_Scanner_StringInfo | 
| 6 | 6 |  { | 
| 7 | - /** | |
| 8 | - * @var Localization_Scanner_StringsCollection | |
| 9 | - */ | |
| 7 | + /** | |
| 8 | + * @var Localization_Scanner_StringsCollection | |
| 9 | + */ | |
| 10 | 10 | protected $collection; | 
| 11 | 11 | |
| 12 | 12 | protected $properties = array(); | 
| @@ -6,24 +6,24 @@ | ||
| 6 | 6 | |
| 7 | 7 | class Localization_Source_Folder extends Localization_Source | 
| 8 | 8 |  { | 
| 9 | - /** | |
| 10 | - * The folder under which all translateable files are kept. | |
| 11 | - * @var string | |
| 12 | - */ | |
| 9 | + /** | |
| 10 | + * The folder under which all translateable files are kept. | |
| 11 | + * @var string | |
| 12 | + */ | |
| 13 | 13 | protected $sourcesFolder; | 
| 14 | 14 | |
| 15 | - /** | |
| 16 | - * @var string | |
| 17 | - */ | |
| 15 | + /** | |
| 16 | + * @var string | |
| 17 | + */ | |
| 18 | 18 | protected $id; | 
| 19 | 19 | |
| 20 | - /** | |
| 21 | - * @param string $alias An alias for this source, to recognize it by. | |
| 22 | - * @param string $label The human readable label, used in the editor. | |
| 23 | - * @param string $group A human readable group label to group several sources by. Used in the editor. | |
| 24 | - * @param string $storageFolder The folder in which to store the localization files. | |
| 25 | - * @param string $sourcesFolder The folder in which to analyze files to find translateable strings. | |
| 26 | - */ | |
| 20 | + /** | |
| 21 | + * @param string $alias An alias for this source, to recognize it by. | |
| 22 | + * @param string $label The human readable label, used in the editor. | |
| 23 | + * @param string $group A human readable group label to group several sources by. Used in the editor. | |
| 24 | + * @param string $storageFolder The folder in which to store the localization files. | |
| 25 | + * @param string $sourcesFolder The folder in which to analyze files to find translateable strings. | |
| 26 | + */ | |
| 27 | 27 | public function __construct(string $alias, string $label, string $group, string $storageFolder, string $sourcesFolder) | 
| 28 | 28 |      { | 
| 29 | 29 | parent::__construct($alias, $label, $group, $storageFolder); | 
| @@ -20,9 +20,9 @@ discard block | ||
| 20 | 20 | */ | 
| 21 | 21 | abstract class Localization_Event | 
| 22 | 22 |  { | 
| 23 | - /** | |
| 24 | - * @var array | |
| 25 | - */ | |
| 23 | + /** | |
| 24 | + * @var array | |
| 25 | + */ | |
| 26 | 26 | protected $args; | 
| 27 | 27 | |
| 28 | 28 | public function __construct(array $args) | 
| @@ -30,13 +30,13 @@ discard block | ||
| 30 | 30 | $this->args = $args; | 
| 31 | 31 | } | 
| 32 | 32 | |
| 33 | - /** | |
| 34 | - * Fetches the argument at the specified index in the | |
| 35 | - * event's arguments list, if it exists. | |
| 36 | - * | |
| 37 | - * @param int $index Zero-based index number. | |
| 38 | - * @return mixed|NULL | |
| 39 | - */ | |
| 33 | + /** | |
| 34 | + * Fetches the argument at the specified index in the | |
| 35 | + * event's arguments list, if it exists. | |
| 36 | + * | |
| 37 | + * @param int $index Zero-based index number. | |
| 38 | + * @return mixed|NULL | |
| 39 | + */ | |
| 40 | 40 | public function getArgument(int $index) | 
| 41 | 41 |      { | 
| 42 | 42 |          if(isset($this->args[$index])) { | 
| @@ -18,24 +18,24 @@ discard block | ||
| 18 | 18 | |
| 19 | 19 | const FILES_CACHE_KEY = 'cachekey'; | 
| 20 | 20 | |
| 21 | - /** | |
| 22 | - * @var bool | |
| 23 | - */ | |
| 21 | + /** | |
| 22 | + * @var bool | |
| 23 | + */ | |
| 24 | 24 | protected $force = false; | 
| 25 | 25 | |
| 26 | - /** | |
| 27 | - * @var Localization_Translator | |
| 28 | - */ | |
| 26 | + /** | |
| 27 | + * @var Localization_Translator | |
| 28 | + */ | |
| 29 | 29 | protected $translator; | 
| 30 | 30 | |
| 31 | - /** | |
| 32 | - * @var string | |
| 33 | - */ | |
| 31 | + /** | |
| 32 | + * @var string | |
| 33 | + */ | |
| 34 | 34 | protected $targetFolder; | 
| 35 | 35 | |
| 36 | - /** | |
| 37 | - * @var string | |
| 38 | - */ | |
| 36 | + /** | |
| 37 | + * @var string | |
| 38 | + */ | |
| 39 | 39 | protected $cacheKeyFile; | 
| 40 | 40 | |
| 41 | 41 | protected $cacheKey = ''; | 
| @@ -118,14 +118,14 @@ discard block | ||
| 118 | 118 | $this->writeCacheKey(); | 
| 119 | 119 | } | 
| 120 | 120 | |
| 121 | - /** | |
| 122 | - * Retrieves a list of all localization client | |
| 123 | - * files that are written to disk. This includes | |
| 124 | - * the locale files and the libraries required | |
| 125 | - * to make it work clientside. | |
| 126 | - * | |
| 127 | - * @return string[] | |
| 128 | - */ | |
| 121 | + /** | |
| 122 | + * Retrieves a list of all localization client | |
| 123 | + * files that are written to disk. This includes | |
| 124 | + * the locale files and the libraries required | |
| 125 | + * to make it work clientside. | |
| 126 | + * | |
| 127 | + * @return string[] | |
| 128 | + */ | |
| 129 | 129 | public function getFilesList() : array | 
| 130 | 130 |      { | 
| 131 | 131 | $files = array(); | 
| @@ -273,11 +273,11 @@ discard block | ||
| 273 | 273 | $this->written[self::FILES_LOCALES] = true; | 
| 274 | 274 | } | 
| 275 | 275 | |
| 276 | - /** | |
| 277 | - * Generates the cache key file, which is used to determine | |
| 278 | - * automatically whether the client libraries need to be | |
| 279 | - * refreshed. | |
| 280 | - */ | |
| 276 | + /** | |
| 277 | + * Generates the cache key file, which is used to determine | |
| 278 | + * automatically whether the client libraries need to be | |
| 279 | + * refreshed. | |
| 280 | + */ | |
| 281 | 281 | protected function writeCacheKey() | 
| 282 | 282 |      { | 
| 283 | 283 |          if(file_exists($this->cacheKeyFile) && !$this->force) { | 
| @@ -289,18 +289,18 @@ discard block | ||
| 289 | 289 | $this->written[self::FILES_CACHE_KEY] = true; | 
| 290 | 290 | } | 
| 291 | 291 | |
| 292 | - /** | |
| 293 | - * Whether the specified files have been written to | |
| 294 | - * disk this session. | |
| 295 | - * | |
| 296 | - * NOTE: only useful when called after <code>writeFiles</code>. | |
| 297 | - * | |
| 298 | - * @param string $filesID | |
| 299 | - * | |
| 300 | - * @see Localization_ClientGenerator::FILES_CACHE_KEY | |
| 301 | - * @see Localization_ClientGenerator::FILES_LOCALES | |
| 302 | - * @see Localization_ClientGenerator::FILES_LIBRARIES | |
| 303 | - */ | |
| 292 | + /** | |
| 293 | + * Whether the specified files have been written to | |
| 294 | + * disk this session. | |
| 295 | + * | |
| 296 | + * NOTE: only useful when called after <code>writeFiles</code>. | |
| 297 | + * | |
| 298 | + * @param string $filesID | |
| 299 | + * | |
| 300 | + * @see Localization_ClientGenerator::FILES_CACHE_KEY | |
| 301 | + * @see Localization_ClientGenerator::FILES_LOCALES | |
| 302 | + * @see Localization_ClientGenerator::FILES_LIBRARIES | |
| 303 | + */ | |
| 304 | 304 | public function areFilesWritten(string $filesID) | 
| 305 | 305 |      { | 
| 306 | 306 |          if(isset($this->written[$filesID])) { | 
| @@ -258,8 +258,7 @@ | ||
| 258 | 258 | if(empty($tokens)) | 
| 259 | 259 |          { | 
| 260 | 260 | $content = '/* No strings found. */'; | 
| 261 | - } | |
| 262 | - else | |
| 261 | + } else | |
| 263 | 262 |          { | 
| 264 | 263 | $content = | 
| 265 | 264 | '/**'.PHP_EOL. | 
| @@ -33,14 +33,14 @@ discard block | ||
| 33 | 33 | */ | 
| 34 | 34 | protected $country; | 
| 35 | 35 | |
| 36 | - /** | |
| 37 | - * @var string | |
| 38 | - */ | |
| 36 | + /** | |
| 37 | + * @var string | |
| 38 | + */ | |
| 39 | 39 | protected $countryCode; | 
| 40 | 40 | |
| 41 | - /** | |
| 42 | - * @var string | |
| 43 | - */ | |
| 41 | + /** | |
| 42 | + * @var string | |
| 43 | + */ | |
| 44 | 44 | protected $languageCode; | 
| 45 | 45 | |
| 46 | 46 | /** | 
| @@ -69,11 +69,11 @@ discard block | ||
| 69 | 69 | $this->languageCode = $tokens[0]; | 
| 70 | 70 | } | 
| 71 | 71 | |
| 72 | - /** | |
| 73 | - * Retrieves the two-letter language code of the locale. | |
| 74 | - * | |
| 75 | - * @return string Language code, e.g. "en", "de" | |
| 76 | - */ | |
| 72 | + /** | |
| 73 | + * Retrieves the two-letter language code of the locale. | |
| 74 | + * | |
| 75 | + * @return string Language code, e.g. "en", "de" | |
| 76 | + */ | |
| 77 | 77 | public function getLanguageCode() : string | 
| 78 | 78 |      { | 
| 79 | 79 | return $this->languageCode; | 
| @@ -100,25 +100,25 @@ discard block | ||
| 100 | 100 | return $this->localeName; | 
| 101 | 101 | } | 
| 102 | 102 | |
| 103 | - /** | |
| 104 | - * Retrieves the shortened version of the locale name, | |
| 105 | - * e.g. "en" or "de". | |
| 106 | - * | |
| 107 | - * @return string | |
| 108 | - * @deprecated | |
| 109 | - * @see Localization_Locale::getLanguageCode() | |
| 110 | - */ | |
| 103 | + /** | |
| 104 | + * Retrieves the shortened version of the locale name, | |
| 105 | + * e.g. "en" or "de". | |
| 106 | + * | |
| 107 | + * @return string | |
| 108 | + * @deprecated | |
| 109 | + * @see Localization_Locale::getLanguageCode() | |
| 110 | + */ | |
| 111 | 111 | public function getShortName() : string | 
| 112 | 112 |      { | 
| 113 | 113 | return $this->getLanguageCode(); | 
| 114 | 114 | } | 
| 115 | 115 | |
| 116 | - /** | |
| 117 | - * Retrieves the two-letter country code of | |
| 118 | - * the locale. | |
| 119 | - * | |
| 120 | - * @return string Lowercase code, e.g. "uk" | |
| 121 | - */ | |
| 116 | + /** | |
| 117 | + * Retrieves the two-letter country code of | |
| 118 | + * the locale. | |
| 119 | + * | |
| 120 | + * @return string Lowercase code, e.g. "uk" | |
| 121 | + */ | |
| 122 | 122 | public function getCountryCode() : string | 
| 123 | 123 |      { | 
| 124 | 124 | return $this->countryCode; | 
| @@ -17,49 +17,49 @@ discard block | ||
| 17 | 17 | */ | 
| 18 | 18 | protected $parser; | 
| 19 | 19 | |
| 20 | - /** | |
| 21 | - * The function names that are included in the search. | |
| 22 | - * @var array | |
| 23 | - */ | |
| 20 | + /** | |
| 21 | + * The function names that are included in the search. | |
| 22 | + * @var array | |
| 23 | + */ | |
| 24 | 24 | protected $functionNames = array(); | 
| 25 | 25 | |
| 26 | - /** | |
| 27 | - * The tokens definitions. | |
| 28 | - * @var array | |
| 29 | - */ | |
| 26 | + /** | |
| 27 | + * The tokens definitions. | |
| 28 | + * @var array | |
| 29 | + */ | |
| 30 | 30 | protected $tokens = array(); | 
| 31 | 31 | |
| 32 | - /** | |
| 33 | - * The total amount of tokens found in the content. | |
| 34 | - * @var integer | |
| 35 | - */ | |
| 32 | + /** | |
| 33 | + * The total amount of tokens found in the content. | |
| 34 | + * @var integer | |
| 35 | + */ | |
| 36 | 36 | protected $totalTokens = 0; | 
| 37 | 37 | |
| 38 | - /** | |
| 39 | - * All texts that have been collected. | |
| 40 | - * @var array | |
| 41 | - */ | |
| 38 | + /** | |
| 39 | + * All texts that have been collected. | |
| 40 | + * @var array | |
| 41 | + */ | |
| 42 | 42 | protected $texts = array(); | 
| 43 | 43 | |
| 44 | - /** | |
| 45 | - * @var string | |
| 46 | - */ | |
| 44 | + /** | |
| 45 | + * @var string | |
| 46 | + */ | |
| 47 | 47 | protected $content = ''; | 
| 48 | 48 | |
| 49 | - /** | |
| 50 | - * @var string | |
| 51 | - */ | |
| 49 | + /** | |
| 50 | + * @var string | |
| 51 | + */ | |
| 52 | 52 | protected $id; | 
| 53 | 53 | |
| 54 | - /** | |
| 55 | - * @var array | |
| 56 | - */ | |
| 54 | + /** | |
| 55 | + * @var array | |
| 56 | + */ | |
| 57 | 57 | protected $warnings = array(); | 
| 58 | 58 | |
| 59 | - /** | |
| 60 | - * The source file that was parsed (if any) | |
| 61 | - * @var string | |
| 62 | - */ | |
| 59 | + /** | |
| 60 | + * The source file that was parsed (if any) | |
| 61 | + * @var string | |
| 62 | + */ | |
| 63 | 63 | protected $sourceFile = ''; | 
| 64 | 64 | |
| 65 | 65 | public function __construct(Localization_Parser $parser) | 
| @@ -70,10 +70,10 @@ discard block | ||
| 70 | 70 | |
| 71 | 71 | abstract protected function getTokens() : array; | 
| 72 | 72 | |
| 73 | - /** | |
| 74 | - * Retrieves the ID of the language. | |
| 75 | - * @return string E.g. "PHP", "Javascript" | |
| 76 | - */ | |
| 73 | + /** | |
| 74 | + * Retrieves the ID of the language. | |
| 75 | + * @return string E.g. "PHP", "Javascript" | |
| 76 | + */ | |
| 77 | 77 | public function getID() : string | 
| 78 | 78 |      { | 
| 79 | 79 |          if(!isset($this->id)) { | 
| @@ -93,12 +93,12 @@ discard block | ||
| 93 | 93 | return $this->sourceFile; | 
| 94 | 94 | } | 
| 95 | 95 | |
| 96 | - /** | |
| 97 | - * Parses the code from a file. | |
| 98 | - * | |
| 99 | - * @param string $path | |
| 100 | - * @throws Localization_Exception | |
| 101 | - */ | |
| 96 | + /** | |
| 97 | + * Parses the code from a file. | |
| 98 | + * | |
| 99 | + * @param string $path | |
| 100 | + * @throws Localization_Exception | |
| 101 | + */ | |
| 102 | 102 | public function parseFile(string $path) : void | 
| 103 | 103 |      { | 
| 104 | 104 | if(!file_exists($path)) | 
| @@ -131,10 +131,10 @@ discard block | ||
| 131 | 131 | ); | 
| 132 | 132 | } | 
| 133 | 133 | |
| 134 | - /** | |
| 135 | - * Parses a source code string. | |
| 136 | - * @param string $content | |
| 137 | - */ | |
| 134 | + /** | |
| 135 | + * Parses a source code string. | |
| 136 | + * @param string $content | |
| 137 | + */ | |
| 138 | 138 | public function parseString($content) : void | 
| 139 | 139 |      { | 
| 140 | 140 | $this->content = $content; | 
| @@ -175,11 +175,11 @@ discard block | ||
| 175 | 175 | ); | 
| 176 | 176 | } | 
| 177 | 177 | |
| 178 | - /** | |
| 179 | - * Retrieves a list of all the function names that are | |
| 180 | - * used as translation functions in the language. | |
| 181 | - * @return array | |
| 182 | - */ | |
| 178 | + /** | |
| 179 | + * Retrieves a list of all the function names that are | |
| 180 | + * used as translation functions in the language. | |
| 181 | + * @return array | |
| 182 | + */ | |
| 183 | 183 | public function getFunctionNames() : array | 
| 184 | 184 |      { | 
| 185 | 185 |          return $this->createToken('dummy')->getFunctionNames(); | 
| @@ -190,13 +190,13 @@ discard block | ||
| 190 | 190 |          Localization::log(sprintf('%1$s parser | %2$s', $this->getID(), $message)); | 
| 191 | 191 | } | 
| 192 | 192 | |
| 193 | - /** | |
| 194 | - * Adds a warning message when a text cannot be parsed correctly for some reason. | |
| 195 | - * | |
| 196 | - * @param Localization_Parser_Token $token | |
| 197 | - * @param string $message | |
| 198 | - * @return Localization_Parser_Warning | |
| 199 | - */ | |
| 193 | + /** | |
| 194 | + * Adds a warning message when a text cannot be parsed correctly for some reason. | |
| 195 | + * | |
| 196 | + * @param Localization_Parser_Token $token | |
| 197 | + * @param string $message | |
| 198 | + * @return Localization_Parser_Warning | |
| 199 | + */ | |
| 200 | 200 | protected function addWarning(Localization_Parser_Token $token, string $message) : Localization_Parser_Warning | 
| 201 | 201 |      { | 
| 202 | 202 | $warning = new Localization_Parser_Warning($this, $token, $message); | 
| @@ -206,34 +206,34 @@ discard block | ||
| 206 | 206 | return $warning; | 
| 207 | 207 | } | 
| 208 | 208 | |
| 209 | - /** | |
| 210 | - * Whether any warnings were generated during parsing. | |
| 211 | - * @return bool | |
| 212 | - */ | |
| 209 | + /** | |
| 210 | + * Whether any warnings were generated during parsing. | |
| 211 | + * @return bool | |
| 212 | + */ | |
| 213 | 213 | public function hasWarnings() : bool | 
| 214 | 214 |      { | 
| 215 | 215 | return !empty($this->warnings); | 
| 216 | 216 | } | 
| 217 | 217 | |
| 218 | - /** | |
| 219 | - * Retrieves all warnings that were generated during parsing, | |
| 220 | - * if any. | |
| 221 | - * | |
| 222 | - * @return Localization_Parser_Warning[] | |
| 223 | - */ | |
| 218 | + /** | |
| 219 | + * Retrieves all warnings that were generated during parsing, | |
| 220 | + * if any. | |
| 221 | + * | |
| 222 | + * @return Localization_Parser_Warning[] | |
| 223 | + */ | |
| 224 | 224 | public function getWarnings() | 
| 225 | 225 |      { | 
| 226 | 226 | return $this->warnings; | 
| 227 | 227 | } | 
| 228 | 228 | |
| 229 | - /** | |
| 230 | - * Creates a token instance: this retrieves information on | |
| 231 | - * the language token being parsed. | |
| 232 | - * | |
| 233 | - * @param array|string $definition The token definition. | |
| 234 | - * @param Localization_Parser_Token $parentToken | |
| 235 | - * @return Localization_Parser_Token | |
| 236 | - */ | |
| 229 | + /** | |
| 230 | + * Creates a token instance: this retrieves information on | |
| 231 | + * the language token being parsed. | |
| 232 | + * | |
| 233 | + * @param array|string $definition The token definition. | |
| 234 | + * @param Localization_Parser_Token $parentToken | |
| 235 | + * @return Localization_Parser_Token | |
| 236 | + */ | |
| 237 | 237 | protected function createToken($definition, Localization_Parser_Token $parentToken=null) : Localization_Parser_Token | 
| 238 | 238 |      { | 
| 239 | 239 | $class = '\AppLocalize\Localization_Parser_Token_'.$this->getID(); | 
| @@ -241,12 +241,12 @@ discard block | ||
| 241 | 241 | return new $class($definition, $parentToken); | 
| 242 | 242 | } | 
| 243 | 243 | |
| 244 | - /** | |
| 245 | - * Parses a translation function token. | |
| 246 | - * | |
| 247 | - * @param int $number | |
| 248 | - * @param Localization_Parser_Token $token | |
| 249 | - */ | |
| 244 | + /** | |
| 245 | + * Parses a translation function token. | |
| 246 | + * | |
| 247 | + * @param int $number | |
| 248 | + * @param Localization_Parser_Token $token | |
| 249 | + */ | |
| 250 | 250 | protected function parseToken(int $number, Localization_Parser_Token $token) | 
| 251 | 251 |      { | 
| 252 | 252 | $textParts = array(); | 
| @@ -4,14 +4,14 @@ discard block | ||
| 4 | 4 | |
| 5 | 5 | abstract class Localization_Parser_Token | 
| 6 | 6 |  { | 
| 7 | - /** | |
| 8 | - * @var array|string | |
| 9 | - */ | |
| 7 | + /** | |
| 8 | + * @var array|string | |
| 9 | + */ | |
| 10 | 10 | protected $definition; | 
| 11 | 11 | |
| 12 | - /** | |
| 13 | - * @var Localization_Parser_Token | |
| 14 | - */ | |
| 12 | + /** | |
| 13 | + * @var Localization_Parser_Token | |
| 14 | + */ | |
| 15 | 15 | protected $parentToken; | 
| 16 | 16 | |
| 17 | 17 | protected $token; | 
| @@ -66,6 +66,6 @@ discard block | ||
| 66 | 66 | 'value' => $this->getValue(), | 
| 67 | 67 | 'line' => $this->getLine(), | 
| 68 | 68 | 'isEncapsedString' => \AppUtils\ConvertHelper::bool2string($this->isEncapsedString()) | 
| 69 | - ); | |
| 69 | + ); | |
| 70 | 70 | } | 
| 71 | 71 | } |