Login   Register  
PHP Classes
elePHPant
Icontem

File: src/eMacros/Runtime/Value/ValueUnset.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Emmanuel Antico  >  eMacros  >  src/eMacros/Runtime/Value/ValueUnset.php  >  Download  
File: src/eMacros/Runtime/Value/ValueUnset.php
Role: Class source
Content type: text/plain
Description: Class source
Class: eMacros
PHP LISP language interpreter
Author: By
Last change:
Date: 2014-01-13 05:23
Size: 775 bytes
 

Contents

Class file image Download
<?php

namespace eMacros\Runtime\Value;

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

class 
ValueUnset implements Applicable {
    
/**
     * Removes a symbol from scope
     * Usage: (unset _var)
     * Returns: null
     * (non-PHPdoc)
     * @see \eMacros\Applicable::apply()
     */
    
public function apply(Scope $scopeGenericList $arguments) {
        if (
count($arguments) == 0) {
            throw new \
BadFunctionCallException("ValueUnset: No parameters found.");
        }
        
        if (!(
$arguments[0] instanceof Symbol)) {
            throw new \
InvalidArgumentException(sprintf("ValueUnset: Expected symbol as first argument, %s found instead."substr(strtolower(strstr(get_class($arguments[0]), '\\')), 1)));
        }
        
        unset(
$scope->symbols[$arguments[0]->symbol]);
    }
}
?>