Пример #1
0
 /**
  * Creates a copy of the environment
  *
  * @param ILess_Environment $env
  * @param array $frames
  * @return ILess_Environment
  */
 public static function createCopy(ILess_Environment $env, array $frames = array())
 {
     // what to copy?
     $copyProperties = array('compress', 'canShortenColors', 'precision', 'ieCompat', 'strictMath', 'strictUnits', 'sourceMap', 'sourceMapOptions', 'importMultiple', 'relativeUrls', 'rootPath', 'dumpLineNumbers', 'contentsMap', 'customVariables', 'currentFileInfo');
     $copy = new ILess_Environment(array(), $env->getFunctionRegistry());
     foreach ($copyProperties as $property) {
         if (property_exists($env, $property)) {
             $copy->{$property} = $env->{$property};
         }
     }
     $copy->frames = $frames;
     return $copy;
 }