PHP Classes

File: src/eMacros/Runtime/HTML/ParseString.php

Recommend this page to a friend!
  Classes of Emmanuel Antico   eMacros   src/eMacros/Runtime/HTML/ParseString.php   Download  
File: src/eMacros/Runtime/HTML/ParseString.php
Role: Class source
Content type: text/plain
Description: Class source
Class: eMacros
PHP LISP language interpreter
Author: By
Last change:
Date: 10 years ago
Size: 629 bytes
 

Contents

Class file image Download
<?php
namespace eMacros\Runtime\HTML;

use
eMacros\Applicable;
use
eMacros\Scope;
use
eMacros\GenericList;
use
eMacros\Symbol;

class
ParseString implements Applicable {
   
/**
     * Parses an input string
     * Usage: (HTML::parse-string "first=value&arr[]=foo+bar&arr[]=baz" _output)
     * Returns: NULL
     * (non-PHPdoc)
     * @see \eMacros\Applicable::apply()
     */
   
public function apply(Scope $scope, GenericList $arguments) {
        if (
count($arguments) == 0) {
            throw new \
BadFunctionCallException("ParseString: No parameters found.");
        }
       
       
$arr = array();
       
parse_str($arguments[0]->evaluate($scope), $arr);
        return
$arr;
    }
}
?>