#!/bin/php . */ '; foreach ($classes as $cls) { $ref = new ReflectionClass($cls); $class_name = Common::snakeCaseToCamelCase($cls); $file = $ref->getFileName(); $class_comment = $ref->getDocComment(); $table_name = $ref->getDefaultProperties()['__table']; $sd = $ref->getMethod('schemaDef'); $start = $sd->getStartLine(); $end = $sd->getEndLine(); $command = "sed -rn '" . implode('; ', [ "s%(return array\\()%\\1\\ \"name\" => \"{$table_name}\",%", 's%schemaDef\(\)%schemaDef(): array%', "{$start},{$end}p", ]) . "' {$file}"; // echo $command . "\n"; $schemaDef = []; exec($command, $schemaDef); $schemaDef = implode("\n", $schemaDef); $class = "