Example #1
0
 /**
  * @param string $string
  * @param bool $include_null
  * @param Context $context
  * @return array
  */
 public static function extractArgs($string, $include_null = TRUE, $context)
 {
     $list = Literals\SassList::_build_list($string, ',');
     $return = [];
     foreach ($list as $k => $value) {
         if (substr($value, -3, 3) == '...' && preg_match(Tree\VariableNode::MATCH, substr($value, 0, -3) . ':', $match)) {
             $list = new Literals\SassList($context->getVariable($match[Tree\VariableNode::NAME]));
             if (count($list->value) > 1) {
                 $return = array_merge($return, $list->value);
                 continue;
             }
         }
         if (strpos($value, ':') !== FALSE && preg_match(Tree\VariableNode::MATCH, $value, $match)) {
             $return[$match[Tree\VariableNode::NAME]] = $match[Tree\VariableNode::VALUE];
         } elseif (substr($value, 0, 1) == '$' && $include_null) {
             $return[str_replace('$', '', $value)] = NULL;
         } elseif ($include_null || $value !== NULL) {
             $return[] = $value;
         }
     }
     return $return;
 }