(non-PHPdoc)
@see \MwbExporter\Object\Base::asCode()
518085
public function asCode($value)
    {
        if ($value instanceof JS) {
            $value = (string) $value;
        } elseif (is_bool($value)) {
            $value = $value ? 'true' : 'false';
        } elseif (is_string($value)) {
            $value = '\''.$value.'\'';
        } elseif (is_array($value)) {
            $tmp = array();
            $useKey = !$this->isKeysNumeric($value);
            foreach ($value as $k => $v) {
                // skip null value
                if (null === $v) {
                    continue;
                }
                $v = $this->asCode($v);
                $tmp[] = $useKey ? sprintf('%s: %s', $k, $v) : $v;
            }
            $multiline = $this->getOption('multiline');
            $value = ($multiline ? "\n" : '').implode($multiline ? ",\n" : ', ', $tmp).($multiline ? "\n" : '');
            if ($useKey) {
                $value = sprintf('{%s}', $value);
            } else {
                $value = sprintf('[%s]', $value);
            }
            if ($multiline) {
                $value = $this->wrapLines($value, 1);
            }
        }

        return $value;
    }
308196
private function codeToMessage($code)
    {
        switch ($code) {
            case JSON_ERROR_SYNTAX:
                $message = "Syntax error";
                break;
            // @codeCoverageIgnoreStart
            // Hard to test cases of JSON error
            case JSON_ERROR_DEPTH:
                $message = "The maximum stack depth has been exceeded";
                break;
            case JSON_ERROR_STATE_MISMATCH:
                $message = "Invalid or malformed JSON";
                break;
            case JSON_ERROR_CTRL_CHAR:
                $message = "Control character error, possibly incorrectly encoded";
                break;
            case JSON_ERROR_UTF8:
                $message = "Malformed UTF-8 characters, possibly incorrectly encoded";
                break;
            case JSON_ERROR_RECURSION:
                $message = "One or more recursive references in the value to be encoded";
                break;
            case JSON_ERROR_INF_OR_NAN:
                $message = "One or more NAN or INF values in the value to be encoded";
                break;
            case JSON_ERROR_UNSUPPORTED_TYPE:
                $message = "A value of a type that cannot be encoded was given";
                break;
            case JSON_ERROR_INVALID_PROPERTY_NAME:
                $message = "A property name that cannot be encoded was given";
                break;
            case JSON_ERROR_UTF16:
                $message = "Malformed UTF-16 characters, possibly incorrectly encoded";
                break;
            default:
                $message = "Unknown localization error";
                break;
            // @codeCoverageIgnoreEnd
        }
        return $message;
    }
212355
public function hasCode($code)
    {
        if ($this->getException() !== null && $this->getException()->getCode() === $code) {
            return true;
        }

        foreach ($this->getErrors() as $message) {
            if ($message['code'] == $code) {
                return true;
            }
        }

        foreach ($this->getWarnings() as $message) {
            if ($message['code'] == $code) {
                return true;
            }
        }

        foreach ($this->getNotices() as $message) {
            if ($message['code'] == $code) {
                return true;
            }
        }

        return false;
    }
1022468
public function formatCode($code, $checked = false, $noTransformation = false)
    {
        return $this->getFormatInstance()->formatCode($code, $checked, $noTransformation);
    }
1268809
public function transpile($code)
    {
        try {
            return AfxService::convertAfxToFusion($code);
        } catch (AfxException $afxException) {
            throw new FusionException(sprintf('Error during AFX-parsing: %s', $afxException->getMessage()));
        }
    }
635310
public function show($code)
    {
        $lang = $this->langRepo->getByCode($code);
        if (empty($lang)) {
            return $this->respondNotFound();
        }
        return $this->respondWithSuccess($lang, new LangTransformer);
    }
724205
public function item($code)
    {
        if( empty(Properties::$items) )
        {
            return false;
        }

        foreach( Properties::$items as $row )
        {
            if( ! is_array($code) )
            {
                $key = array_search($code, $row);
            }
            else
            {
                if( isset($row[key($code)]) && $row[key($code)] == current($code) )
                {
                    $key = $row;
                }
            }

            if( ! empty($key) )
            {
                return (object) $row;
            }
        }
    }
992406
private function resolveObject($code)
    {
        $value = $this->resolveCode($code);

        if (!\is_object($value)) {
            throw new RuntimeException('Unable to inspect a non-object');
        }

        return $value;
    }
1361206
public function html($code)
    {
        if ($this->sdopx->parsingType == Sdopx::PARSING_SQL) {
            if ($code != '') {
                if (trim($code) == '') {
                    $this->output[] = ' ';
                    return;
                } else {
                    if (preg_match('@^\s+([\w\W]+)\s+$@', $code, $mt)) {
                        $this->output[] = ' ' . trim($mt[1]) . ' ';
                    } else if (preg_match('@^\s+([\w\W]+)$@', $code, $mt)) {
                        $this->output[] = ' ' . trim($mt[1]);
                    } else if (preg_match('@^([\w\W]+)\s+$@', $code, $mt)) {
                        $this->output[] = trim($mt[1]) . ' ';
                    } else {
                        $this->output[] = $code;
                    }
                    return;
                }
            }
            return;
        }
        $this->output[] = $code;
    }
523190
public static function getTypeForCode( $typeCode )
	{
		return isset( XmlTypeCode::$codeToTypeMap[ $typeCode ] )
			? XmlTypeCode::$codeToTypeMap[ $typeCode ]
			: false;
	}
500171
public function setCode(callable $code) {
        if (!is_callable($code)) {
            throw new \InvalidArgumentException('Invalid callable provided to Command::setCode.');
        }

        if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
            $r = new \ReflectionFunction($code);
            if (null === $r->getClosureThis()) {
                $code = \Closure::bind($code, $this);
            }
        }

        $this->code = $code;

        return $this;
    }
637280
function translate ($code)
    {
        if (preg_match_all("/<\?_\(\"(.*)\"\)\?>/siU", $code, $matches, PREG_SET_ORDER)) {
            foreach ($matches as $match) {
                if (isset($match[1])) {
                    $code = str_replace($match[0], gettext(stripslashes($match[1])), $code);
                }
            }
        }
        return $code;
    }
1371718
public function setCode($code)
    {
        if (!is_scalar($code)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Wrong parameters for %s([int|string $code]); %s given.',
                    __METHOD__,
                    is_object($code) ? get_class($code) : gettype($code)
                ),
                E_ERROR
            );
        }

        $this->code = $code;

        return $this;
    }
510390
public function getFirstValueByAttributeCodeAsString(string $code, $asTitle = true)
    {
        $attributeValue = $this->getFirstValueByAttributeCode($code);

        if (!$attributeValue) {
            return "";
        }

        $field = $asTitle ? 'title' : 'value';

        return $attributeValue->$field;
    }
778851
public function process($code) {
		// Flatten out the code so the tabs and newlines don't get in the way
		$this->code = str_replace(
			array("\n","\r","\t"), 
			array("","",""),
			$code
		);		

		$blockList = array ();
		$blockIndex = array ();

		preg_match_all("/<% (loop|with) (.*?) %>/", $this->code,  $openBlocks, PREG_OFFSET_CAPTURE);
		preg_match_all("/<% end_(loop|with) %>/", $this->code, $closeBlocks, PREG_OFFSET_CAPTURE);
		
		if(!$openBlocks || !$closeBlocks) return;

		$openBlocks = reset($openBlocks);
		$closeBlocks = reset($closeBlocks);
		
		// If there aren't the same about of opening delimiters as close delimiters,
		// this is a malformed template
		if(count($openBlocks) != count($closeBlocks)) {
			throw new ValidationException("Template is malformed. Open loops and closed loops are mismatched");
		}

		$loops = array_merge($openBlocks, $closeBlocks);
		
		// Index all the mactches by their offset, e.g. strpos
		foreach($loops as $match) {
			$blockList[$match[1]] = $match[0];	
		}
		ksort($blockList, SORT_NUMERIC);


		$openBlocks = array();

		// Now that each block has a unique identifier (its offset), create an index
		// that allows lookups of its parent block and where it ends
		foreach($blockList as $pos => $block) {
			if($block != "<% end_loop %>" && $block != "<% end_with %>") {
				$blockIndex[$pos] = array (
					'parent' => empty($openBlocks) ? 0 : end($openBlocks)
				);
				array_push($openBlocks, $pos);	
			}
			else {
				$opener = array_pop($openBlocks);
				$blockIndex[$opener]['end'] = $pos;
			}
		}

		// Lopp through the index to create ReflectionTemplate_Block instances for each.
		foreach($blockIndex as $pos => $data) {
			$block = new ReflectionTemplate_Block($this, $pos, $data['end'], $data['parent']);
			if(!in_array(strtolower($block->getName()), $this->getTemplateAccessors())) {
				$this->blockManifest[$pos] = $block;
				if($data['parent'] > 0) {
					$this->getBlockByID($data['parent'])->addChild($pos);
				}
			}
		}				

		// Generate a top level block, consisting of all the vars and conditions in the top scope.
		// Strips out all the contents of every known block, and what you're left with is the
		// "root" template
		$originalCode = $this->code;
		foreach($this->getBlocks() as $block) {
			$this->code = str_replace($block->getOuterContents(), "", $this->code);
		}
		$top = new ReflectionTemplate_Block($this);
		$this->topBlock = $top;
		$this->code = $originalCode;
	}
406265
protected function buildInlineCode() {
        $result = '';
        foreach ($this->events as $event) {
            /* @var $event \ManiaScript\Builder\Event\AbstractEvent */
            if ($event->getInline()) {
                $result .= $event->getCode() . PHP_EOL;
            } else {
                $result .= $this->buildHandlerFunctionCall($event);
            }
        }
        return $result;
    }
532901
function getCode()
    {

        $out = $this->getHeaderCode();
        $out .= $this->getFormItemsCode();
        $out .= $this->getFooterCode();

        return $out;
    }