Add CoolSMS PHP SDK, and update Composer dependencies

This commit is contained in:
Kijin Sung 2016-11-03 20:19:28 +09:00
parent 40c43e8fa0
commit c719fc0500
242 changed files with 3487 additions and 28983 deletions

View file

@ -142,11 +142,16 @@ class Parser
*/
public function parse($buffer)
{
// strip BOM (byte order marker)
if (substr($buffer, 0, 3) === "\xef\xbb\xbf") {
$buffer = substr($buffer, 3);
}
$this->buffer = rtrim($buffer, "\x00..\x1f");
$this->count = 0;
$this->env = null;
$this->inParens = false;
$this->eatWhiteDefault = true;
$this->buffer = rtrim($buffer, "\x00..\x1f");
$this->saveEncoding();
$this->extractLineNumbers($buffer);
@ -617,8 +622,8 @@ class Parser
$this->end()
) {
// check for '!flag'
$assignmentFlag = $this->stripAssignmentFlag($value);
$this->append([Type::T_ASSIGN, $name, $value, $assignmentFlag], $s);
$assignmentFlags = $this->stripAssignmentFlags($value);
$this->append([Type::T_ASSIGN, $name, $value, $assignmentFlags], $s);
return true;
}
@ -895,7 +900,7 @@ class Parser
$len = strlen($what);
if (substr($this->buffer, $this->count, $len) === $what) {
if (strcasecmp(substr($this->buffer, $this->count, $len), $what) === 0) {
$this->count += $len;
if ($eatWhitespace) {
@ -2287,25 +2292,29 @@ class Parser
*
* @param array $value
*
* @return string
* @return array
*/
protected function stripAssignmentFlag(&$value)
protected function stripAssignmentFlags(&$value)
{
$token = &$value;
$flags = [];
for ($token = &$value; $token[0] === Type::T_LIST && ($s = count($token[2])); $token = &$lastNode) {
$lastNode = &$token[2][$s - 1];
if ($lastNode[0] === Type::T_KEYWORD && in_array($lastNode[1], ['!default', '!global'])) {
while ($lastNode[0] === Type::T_KEYWORD && in_array($lastNode[1], ['!default', '!global'])) {
array_pop($token[2]);
$node = end($token[2]);
$token = $this->flattenList($token);
return $lastNode[1];
$flags[] = $lastNode[1];
$lastNode = $node;
}
}
return false;
return $flags;
}
/**