/**
  * @return mixed
  */
 public function getValue($line)
 {
     if (false !== ($line2 = QuoteTool::unquote($line))) {
         $line = $line2;
         if (true === $this->quotedValueIsAlwaysString) {
             return $line;
         }
     }
     return parent::getValue($line);
 }
Example #2
0
 public function findKey($lineContent, &$pos = 0)
 {
     $ret = false;
     if (false !== ($lastPhpEndQuote = QuoteTool::getCorrespondingEndQuotePos($lineContent))) {
         /**
          * the very next non blank char should be the kvSep in the case of a valid key
          */
         $after = mb_substr($lineContent, $lastPhpEndQuote + 1);
         $fromQuoteToKvSepLen = 0;
         MicroStringTool::skipBlanks($after, $fromQuoteToKvSepLen);
         // assume kvSep is not blank
         if ($this->kvSep === mb_substr($after, $fromQuoteToKvSepLen, $this->kvSepLen)) {
             $ret = QuoteTool::unquote(mb_substr($lineContent, 0, $lastPhpEndQuote + 1));
             $pos += $lastPhpEndQuote + 1 + $fromQuoteToKvSepLen + $this->kvSepLen;
         }
     } elseif (false !== ($kvPos = mb_strpos($lineContent, $this->kvSep))) {
         $ret = trim(mb_substr($lineContent, 0, $kvPos));
         $pos += $kvPos + $this->kvSepLen;
     }
     return $ret;
 }