Changeset View
Changeset View
Standalone View
Standalone View
src/parser/argument/PhutilArgumentSpellingCorrector.php
Context not available. | |||||
// If we're correcting commands, never correct an input which begins | // If we're correcting commands, never correct an input which begins | ||||
// with "-", since this is almost certainly intended to be a flag. | // with "-", since this is almost certainly intended to be a flag. | ||||
if ($this->getMode() === self::MODE_COMMANDS) { | if ($this->getMode() === self::MODE_COMMANDS) { | ||||
if (preg_match('/^-/', $input)) { | if (@preg_match('/^-/', $input)) { | ||||
return array(); | return array(); | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
if ($this->getMode() === self::MODE_COMMANDS) { | if ($this->getMode() === self::MODE_COMMANDS) { | ||||
$prefixes = array(); | $prefixes = array(); | ||||
foreach ($options as $option) { | foreach ($options as $option) { | ||||
if (!strncmp($input, $option, strlen($input))) { | if (!strncmp($input, $option, @strlen($input))) { | ||||
$prefixes[] = $option; | $prefixes[] = $option; | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
} | } | ||||
foreach ($distances as $option => $distance) { | foreach ($distances as $option => $distance) { | ||||
if (phutil_utf8_strlen($option) < $distance) { | if (phutil_utf8strlen($option) < $distance) { | ||||
unset($distances[$option]); | unset($distances[$option]); | ||||
} | } | ||||
} | } | ||||
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