Created
August 27, 2014 05:39
-
-
Save neogeek/ec5b1f481c1f0dcc4526 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require('Overseer-Framework/framework.php'); | |
$methods = []; | |
function deindent($string) { | |
preg_match('/(?:^|\n)([ \t]*)[^\s]/', $string, $whitespace); | |
return trim(preg_replace('/(^|\n)' . $whitespace[1] . '/', '$1', $string)); | |
} | |
preg_match_all('/\/(?:\*{2})(.+?)\*\/(.+?)\/\*/s', file_get_contents('facade.js'), $blocks, PREG_SET_ORDER); | |
foreach ($blocks as &$block) { | |
$block[1] = deindent($block[1]); | |
$block[1] = preg_replace('/(^|\n)\*/', '$1', $block[1]); | |
preg_match('/(.*?)\n{2}/', $block[1], $description); | |
preg_match_all('/@([^\s]+)\s*(?:\{(.+?)\})?\s*([^\n]+)?/', $block[1], $tags, PREG_SET_ORDER); | |
$block[2] = deindent($block[2]); | |
array_push($methods, Array( | |
'tags' => $tags, | |
'description' => trim($description[1]), | |
'isPrivate' => false, | |
'code' => $block[2], | |
'ctx' => Array( | |
'string' => preg_replace('/^function|\s*=\s*function\s*|\(.*?\)\s+\{/', '', strtok($block[2], PHP_EOL)) | |
) | |
)); | |
} | |
print_array($methods[1]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment