WMarkDown/PHP/Abstracts/WMarkDown.Abstracts.ScriptsAnalyzer.php

43 lines
1.9 KiB
PHP
Raw Permalink Normal View History

<?php
namespace WMarkDown\Abstracts;
abstract class ScriptsAnalyzer implements \WMarkDown\Interfaces\ScriptsAnalyzer{
protected $wmarkdown = null;
protected $parent = null;
protected $common = null;
protected $original_wmd = null;
protected $root = null;
protected $root_l = null;
protected $class = null;
protected $object = null;
public function __construct($wmarkdown, $parent, $input = null){
$this->wmarkdown = $wmarkdown;
$this->parent = $parent;
$this->common = $input["common"];
$this->original_wmd = $input["original_wmd"];
$this->root = $input["root"];
$this->root_l = $input["root_l"];
$this->class = $input["class"];
$this->object = $input["object"];
}
protected function get_data($extension, $wmd_path){
return \WMarkDown::string_variables(file_exists($wmd_path) ? file_get_contents($wmd_path) : $this->original_wmd, array_merge([
"subkey_words" => preg_match('/^.+' . $this->common["project"] . '\.([^\/]+)\.' . $extension . '\.w\.md$/', $wmd_path) ? preg_replace_callback('/^.+' . $this->common["project"] . '\.([^\/]+)\.php\.w\.md$/', function($values){
return substr(preg_replace('/[,\.]+/', ",", preg_replace_callback('/([A-Z]+)?([A-Z][a-z0-9]+)/', function($subvalues){
return ($subvalues[1] ? "," . $subvalues[1] : "") . "," . strtolower($subvalues[2]);
}, $values[1])), 1);
}, $wmd_path) : "main",
"path" => substr($wmd_path, $this->root_l + 8),
"subpath" => substr($wmd_path, $this->root_l + 8, -5),
"file" => preg_replace('/^.+\/([^\/]+)\.w\.md$/', "$1", $wmd_path)
], $this->common));
}
};