Changeset View
Changeset View
Standalone View
Standalone View
src/parser/PhutilSimpleOptions.php
Context not available. | |||||
if ($type != 'word') { | if ($type != 'word') { | ||||
return array(); | return array(); | ||||
} | } | ||||
if (!strlen($value)) { | if (!@strlen($value)) { | ||||
return array(); | return array(); | ||||
} | } | ||||
$key = $this->normalizeKey($value); | $key = $this->normalizeKey($value); | ||||
Context not available. | |||||
$result = array(); | $result = array(); | ||||
foreach ($options as $name => $value) { | foreach ($options as $name => $value) { | ||||
$name = $this->normalizeKey($name); | $name = $this->normalizeKey($name); | ||||
if (!strlen($value)) { | if (!@strlen($value)) { | ||||
continue; | continue; | ||||
} | } | ||||
if ($value === true) { | if ($value === true) { | ||||
Context not available. | |||||
private function normalizeKey($key) { | private function normalizeKey($key) { | ||||
if (!strlen($key)) { | if (!@strlen($key)) { | ||||
throw new Exception(pht('Empty key is invalid!')); | throw new Exception(pht('Empty key is invalid!')); | ||||
} | } | ||||
if (!$this->caseSensitive) { | if (!$this->caseSensitive) { | ||||
$key = strtolower($key); | $key = @strtolower($key); | ||||
} | } | ||||
return $key; | return $key; | ||||
} | } | ||||
private function quoteString($string, $escape) { | private function quoteString($string, $escape) { | ||||
if (preg_match('/[^a-zA-Z0-9]/', $string)) { | if (@preg_match('/[^a-zA-Z0-9]/', $string)) { | ||||
$string = '"'.addcslashes($string, '\\\'"'.$escape).'"'; | $string = '"'.addcslashes($string, '\\\'"'.$escape).'"'; | ||||
} | } | ||||
return $string; | return $string; | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0