PMCORE-4013 Wizard trigger: is using a old library thirdparty/wizard please research to use a new or Reflection
This commit is contained in:
@@ -96,7 +96,6 @@
|
||||
"thirdparty/pear",
|
||||
"thirdparty/phing",
|
||||
"thirdparty/pake",
|
||||
"thirdparty/wizard",
|
||||
"rbac/engine/classes/"
|
||||
],
|
||||
"files": [
|
||||
|
||||
274
tests/resources/ContentPHPSourceCode.txt
Normal file
274
tests/resources/ContentPHPSourceCode.txt
Normal file
@@ -0,0 +1,274 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ExampleNamespace;
|
||||
|
||||
use Some\Classes\{
|
||||
ClassA,
|
||||
ClassB,
|
||||
ClassC as C
|
||||
};
|
||||
|
||||
/**
|
||||
* Test
|
||||
*/
|
||||
class Example implements Iface1, Iface2, Iface3
|
||||
{
|
||||
|
||||
#[A1("param")]
|
||||
private ClassA|ClassB|null $unionType;
|
||||
|
||||
/**
|
||||
* Test
|
||||
* @var ClassA&ClassB
|
||||
*/
|
||||
private ClassA&ClassB $intersectionType;
|
||||
|
||||
/**
|
||||
* Test
|
||||
* @param type $a
|
||||
* @param type $b
|
||||
*/
|
||||
public function ifExample($a, $b)
|
||||
{
|
||||
if (convert($a) > $b) {
|
||||
echo "a is bigger than b";
|
||||
} elseif ($a == $b) {
|
||||
echo $a . " is equal to " . $b[0];
|
||||
} else {
|
||||
$result = getText($this->property1, $this->property2);
|
||||
}
|
||||
$result = $a < $b ? $a : $b;
|
||||
}
|
||||
|
||||
/**
|
||||
* test
|
||||
*/
|
||||
public function forExample()
|
||||
{
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
echo 'Item: ';
|
||||
echo $i;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
*/
|
||||
public function foreachEample()
|
||||
{
|
||||
$arr = array(1, 2, 3, 4, "b" => 5, "a" => 6);
|
||||
foreach ($arr as &$value) {
|
||||
$value = (int) $value * 2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
*/
|
||||
public function whileExample()
|
||||
{
|
||||
$i = 1;
|
||||
while ($i <= 10) {
|
||||
echo $i++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
* @param type $i
|
||||
*/
|
||||
public function doWhileExample($i)
|
||||
{
|
||||
do {
|
||||
echo $i--;
|
||||
} while ($i > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
*/
|
||||
public function switchExample()
|
||||
{
|
||||
switch ($i) {
|
||||
case 0:
|
||||
echo "i equals 0";
|
||||
break;
|
||||
case 1:
|
||||
echo "i equals 1";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
*/
|
||||
public function matchExample()
|
||||
{
|
||||
$result = match ($i) {
|
||||
1, 2, 3 => "1, 2, or 3",
|
||||
4, 5, => "4 or 5",
|
||||
default => $this->getDefaultValue(),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
* @return int
|
||||
*/
|
||||
public function getDefaultValue(): int
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
*/
|
||||
public function tryExample()
|
||||
{
|
||||
try {
|
||||
echo inverse(5) . "\n";
|
||||
} catch (Exception $e) {
|
||||
echo 'Caught exception: ' . $e->getMessage() . "\n";
|
||||
} finally {
|
||||
echo "Finally block";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
* @param type $arg
|
||||
* @return \ExampleNamespace\#anon#ContentPHPSourceCode_php#1
|
||||
*/
|
||||
public function anonymousClassExample($arg)
|
||||
{
|
||||
$instance = new class($arg) extends Anonymous
|
||||
{
|
||||
|
||||
public function __construct($arg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function anon()
|
||||
{
|
||||
echo "anonymous";
|
||||
}
|
||||
};
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
* @param type $arg1
|
||||
* @param type $arg2
|
||||
* @param type $arg3
|
||||
* @param type $arg4
|
||||
* @param type $arg5
|
||||
*/
|
||||
public function alignParamsExample($arg1, $arg2, $arg3, $arg4, $arg5)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
* @param Class1|Class2|null $object
|
||||
* @return int|float|null
|
||||
*/
|
||||
public function unionTypesExample(Class1|Class2|null $object): int|float|null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
* @param ClassA&ClassB $object
|
||||
* @return ClassA&ClassB
|
||||
*/
|
||||
public function intersectionTypesExample(ClassA&ClassB $object): ClassA&ClassB
|
||||
{
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
* @param object $object
|
||||
*/
|
||||
public function nullsafeOperatorExample(object $object)
|
||||
{
|
||||
$object?->nullsafe();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enum EnumExample: string
|
||||
{
|
||||
|
||||
case FOO = 'F';
|
||||
case BAR = 'B';
|
||||
|
||||
public function example(): string
|
||||
{
|
||||
return match ($this) {
|
||||
static::FOO => 'Foo',
|
||||
static::BAR => 'Bar',
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$anonymousFunc = function ($arg) use ($param): int {
|
||||
return 1;
|
||||
};
|
||||
|
||||
// Wrapping: Method Call Arguments must be set
|
||||
(new Example())->alignParamsExample('one', 'two', 'three', 'four', 'five');
|
||||
|
||||
/**
|
||||
* Test
|
||||
* @param type $a
|
||||
* @param type $b
|
||||
*/
|
||||
function namedArguments($a, $b)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* ProcessMaker has made a number of its PHP functions available be used in triggers and conditions.
|
||||
* Most of these functions are wrappers for internal functions used in Gulliver, which is the development framework
|
||||
* used by ProcessMaker.
|
||||
* @class pmFunctions
|
||||
*
|
||||
* @name ProcessMaker Functions
|
||||
* @icon /images/pm.gif
|
||||
* @className class.pmFunctions.php
|
||||
*/
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Create a new user
|
||||
*
|
||||
* @name PMFNewUser
|
||||
* @label PMF New User
|
||||
*
|
||||
* @param string | $test
|
||||
*
|
||||
* @return array | $response | Response
|
||||
*/
|
||||
function testAnnotation($test){
|
||||
return [];
|
||||
}
|
||||
|
||||
namedArguments(a: 1, b: 2);
|
||||
|
||||
$shortName = 10;
|
||||
$veryLooongName = 20;
|
||||
$data = [
|
||||
'short_key' => 10,
|
||||
'very_looong_key' => 100,
|
||||
];
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\PHPReflectionClass;
|
||||
|
||||
use ProcessMaker\PHPReflectionClass\MethodStructure;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ClassStructureTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Instance of ClassStructure.
|
||||
* @var ClassStructure
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* This setUp method.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->object = new ClassStructure();
|
||||
}
|
||||
|
||||
/**
|
||||
* This test the method deleteInfo.
|
||||
* @covers ProcessMaker\PHPReflectionClass\ClassStructure::deleteInfo
|
||||
* @test
|
||||
*/
|
||||
public function testDeleteInfo()
|
||||
{
|
||||
//assert false
|
||||
$result1 = $this->object->deleteInfo("test1");
|
||||
$this->assertFalse($result1);
|
||||
|
||||
//assert true
|
||||
$this->object->info["test2"] = [];
|
||||
$result2 = $this->object->deleteInfo("test2");
|
||||
$this->assertTrue($result2);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test the method getInfo.
|
||||
* @covers ProcessMaker\PHPReflectionClass\ClassStructure::getInfo
|
||||
* @test
|
||||
*/
|
||||
public function testGetInfo()
|
||||
{
|
||||
//assert false
|
||||
$result1 = $this->object->getInfo("test1");
|
||||
$this->assertFalse($result1);
|
||||
|
||||
//assert true
|
||||
$this->object->info["test2"] = [];
|
||||
$result2 = $this->object->getInfo("test2");
|
||||
$this->assertEquals([], $result2);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test the method parseFromFile.
|
||||
* @covers ProcessMaker\PHPReflectionClass\ClassStructure::parseFromFile
|
||||
* @test
|
||||
*/
|
||||
public function testParseFromFile()
|
||||
{
|
||||
//assert false
|
||||
$result1 = $this->object->parseFromFile("invalidPath");
|
||||
$this->assertFalse($result1);
|
||||
|
||||
$filename = PATH_TRUNK . "tests/resources/ContentPHPSourceCode.txt";
|
||||
$result2 = $this->object->parseFromFile($filename);
|
||||
$this->assertTrue($result2);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test the method setInfo.
|
||||
* @covers ProcessMaker\PHPReflectionClass\ClassStructure::setInfo
|
||||
* @test
|
||||
*/
|
||||
public function testSetInfo()
|
||||
{
|
||||
$this->object->setInfo("test1", "testing");
|
||||
$this->assertEquals($this->object->info["test1"], "testing");
|
||||
}
|
||||
|
||||
/**
|
||||
* This test the method setMethod.
|
||||
* @covers ProcessMaker\PHPReflectionClass\ClassStructure::setMethod
|
||||
* @test
|
||||
*/
|
||||
public function testSetMethod()
|
||||
{
|
||||
//assert false
|
||||
$result1 = $this->object->setMethod(null);
|
||||
$this->assertFalse($result1);
|
||||
|
||||
//assert true
|
||||
$method = new MethodStructure("testing");
|
||||
$result2 = $this->object->setMethod($method);
|
||||
$this->assertTrue($result2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\PHPReflectionClass;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
class MethodStructureTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Instance of MethodStructure.
|
||||
* @var MethodStructure
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* This setUp method.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->object = new MethodStructure("test");
|
||||
}
|
||||
|
||||
/**
|
||||
* This test the method getInfo.
|
||||
* @covers ProcessMaker\PHPReflectionClass\MethodStructure::getInfo
|
||||
* @test
|
||||
*/
|
||||
public function testGetInfo()
|
||||
{
|
||||
//assert false
|
||||
$result1 = $this->object->getInfo("test");
|
||||
$this->assertFalse($result1);
|
||||
|
||||
//assert true
|
||||
$this->object->info["test2"] = [];
|
||||
$result2 = $this->object->getInfo("test2");
|
||||
$this->assertEquals([], $result2);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test the method setInfo.
|
||||
* @covers ProcessMaker\PHPReflectionClass\MethodStructure::setInfo
|
||||
* @test
|
||||
*/
|
||||
public function testSetInfo()
|
||||
{
|
||||
$this->object->setInfo("test1", "test1");
|
||||
$this->assertEquals("test1", $this->object->info["test1"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test the method setParam.
|
||||
* @covers ProcessMaker\PHPReflectionClass\MethodStructure::setParam
|
||||
* @test
|
||||
*/
|
||||
public function testSetParam()
|
||||
{
|
||||
$this->object->setParam("test2", "test2");
|
||||
$this->assertEquals("test2", $this->object->params["test2"]);
|
||||
}
|
||||
}
|
||||
39
thirdparty/wizard/include.php
vendored
39
thirdparty/wizard/include.php
vendored
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
This file is part of ActiveLink PHP XML Package (www.active-link.com).
|
||||
Copyright (c) 2002-2004 by Zurab Davitiani
|
||||
|
||||
You can contact the author of this software via E-mail at
|
||||
hattrick@mailcan.com
|
||||
|
||||
ActiveLink PHP XML Package is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ActiveLink PHP XML Package is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ActiveLink PHP XML Package; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Include file for ActiveLink IORCA
|
||||
*/
|
||||
|
||||
|
||||
// define included package locations
|
||||
$GLOBALS["IORCA"]["BASE"]["PATH"] = dirname(__FILE__) . "/";
|
||||
|
||||
|
||||
function import($classPath) {
|
||||
$importFile = str_replace(".", "/", $classPath) . ".php";
|
||||
require_once($GLOBALS["IORCA"]["BASE"]["PATH"] . $importFile);
|
||||
}
|
||||
|
||||
?>
|
||||
242
thirdparty/wizard/org/active-link/doc/DocHTML.php
vendored
242
thirdparty/wizard/org/active-link/doc/DocHTML.php
vendored
@@ -1,242 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
This file is part of ActiveLink PHP DOC Package (www.active-link.com).
|
||||
Copyright (c) 2002-2004 by Zurab Davitiani
|
||||
|
||||
You can contact the author of this software via E-mail at
|
||||
hattrick@mailcan.com
|
||||
|
||||
ActiveLink PHP DOC Package is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ActiveLink PHP DOC Package is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ActiveLink PHP DOC Package; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
import("org.active-link.xml.XML");
|
||||
import("org.active-link.doc.PHPClass");
|
||||
import("org.active-link.doc.Method");
|
||||
|
||||
/**
|
||||
* DocHTML parses PHP class file comments and generates documentation
|
||||
* @class DocHTML
|
||||
* @package org.active-link.doc
|
||||
* @author Zurab Davitiani
|
||||
* @version 0.3.4
|
||||
* @requires XML, PHPClass, Method
|
||||
* @see PHPClass
|
||||
*/
|
||||
|
||||
class DocHTML {
|
||||
|
||||
var $CSSFile;
|
||||
var $CSSFileTag;
|
||||
var $CSSString;
|
||||
var $CSSStringTag;
|
||||
var $CSSStringDefault;
|
||||
|
||||
/**
|
||||
* Constructor, runs when new object instance is created, sets default values
|
||||
* @method DocHTML
|
||||
*/
|
||||
function DocHTML() {
|
||||
$this->CSSStringDefault = "
|
||||
body {background-color: white;}
|
||||
a {font-family: monospace;}
|
||||
ul {list-style-type: none;}
|
||||
.classTitle {color: blue;}
|
||||
.name {color: black;}
|
||||
.version {color: black;}
|
||||
.requires {color: red;}
|
||||
.extends {color: black;}
|
||||
.description {color: black;font-family: sans-serif;}
|
||||
.author {color: blue;}
|
||||
.methodsTitle {color: blue;}
|
||||
.methodList {color: blue;}
|
||||
.methodName {color: blue;font-weight: bold;}
|
||||
.returns {color: black;}
|
||||
.param {color: black;font-weight: bold;font-family: monospace;}
|
||||
";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns class documentation as a string, formatted in HTML
|
||||
* If argument is a filename, it parses the file for comments and generates documentation
|
||||
* If argument is an object of type PHPClass, then documentation is generated from it
|
||||
* @method getClassDoc
|
||||
* @param mixed argument
|
||||
* @returns string HTML-formatted documentation if successful, false otherwise
|
||||
*/
|
||||
function getClassDoc($argument) {
|
||||
if(is_object($argument) && get_class($argument) == "phpclass")
|
||||
return $this->getClassDocFromClass($argument);
|
||||
elseif(is_string($argument))
|
||||
return $this->getClassDocFromFile($argument);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns class documentation as a string, formatted in HTML
|
||||
* @method getClassDocFromClass
|
||||
* @param object objClass
|
||||
* @returns string HTML-formatted documentation if successful, false otherwise
|
||||
*/
|
||||
function getClassDocFromClass($objClass) {
|
||||
if(is_object($objClass) && get_class($objClass) == "phpclass") {
|
||||
$classDocXML = new XML_("html");
|
||||
// ---------------------- HEAD ---------------------- //
|
||||
$headXML = new XMLBranch("head");
|
||||
$headXML->setTagContent($objClass->getInfo("name"), "head/title");
|
||||
$headXML->setTagContent("", "head/meta");
|
||||
$headXML->setTagAttribute("http-equiv", "content-type", "head/meta");
|
||||
$headXML->setTagAttribute("content", "text/html; charset=ISO-8859-1", "head/meta");
|
||||
$headXML->setTagContent($this->CSSStringDefault, "head/style");
|
||||
$headXML->setTagAttribute("type", "text/css", "head/style");
|
||||
// ---------------------- BODY ---------------------- //
|
||||
$bodyXML = new XMLBranch("body");
|
||||
$classTitleXML = new XMLBranch("h1");
|
||||
$classTitleXML->setTagAttribute("class", "classTitle");
|
||||
$classTitleXML->setTagContent($objClass->getInfo("name") . " Class");
|
||||
$bodyXML->addXMLBranch($classTitleXML);
|
||||
foreach($objClass->info as $infoKey => $infoValue) {
|
||||
$brXML = new XMLBranch("br");
|
||||
$bodyXML->addXMLBranch($brXML);
|
||||
if(is_array($infoValue)) {
|
||||
$spanXML = new XMLBranch("span");
|
||||
$spanXML->setTagAttribute("class", $infoKey);
|
||||
$spanXML->setTagContent(ucfirst($infoKey) . ":");
|
||||
$ulXML = new XMLBranch("ul");
|
||||
$ulXML->setTagAttribute("class", $infoKey);
|
||||
foreach($infoValue as $value) {
|
||||
$liXML = new XMLBranch("li");
|
||||
$liXML->setTagContent($value);
|
||||
$ulXML->addXMLBranch($liXML);
|
||||
}
|
||||
$bodyXML->addXMLBranch($spanXML);
|
||||
$bodyXML->addXMLBranch($ulXML);
|
||||
}
|
||||
else {
|
||||
$spanXML = new XMLBranch("span");
|
||||
$spanXML->setTagAttribute("class", $infoKey);
|
||||
$spanXML->setTagContent(ucfirst($infoKey) . ": " . $infoValue);
|
||||
$bodyXML->addXMLBranch($spanXML);
|
||||
}
|
||||
}
|
||||
$hrXML = new XMLBranch("hr");
|
||||
$bodyXML->addXMLBranch($hrXML);
|
||||
$h2XML = new XMLBranch("h2");
|
||||
$h2XML->setTagAttribute("class", "methodsTitle");
|
||||
$h2XML->setTagContent("All Methods");
|
||||
$bodyXML->addXMLBranch($h2XML);
|
||||
$spanXML = new XMLBranch("span");
|
||||
$spanXML->setTagAttribute("class", "methodList");
|
||||
foreach($objClass->methods as $methodName => $method) {
|
||||
$aMethodXML = new XMLBranch("a");
|
||||
$aMethodXML->setTagAttribute("href", "#" . $methodName);
|
||||
$aMethodXML->setTagContent($methodName);
|
||||
$brXML = new XMLBranch("br");
|
||||
$spanXML->addXMLBranch($aMethodXML);
|
||||
$spanXML->addXMLBranch($brXML);
|
||||
}
|
||||
$bodyXML->addXMLBranch($spanXML);
|
||||
foreach($objClass->methods as $methodName => $method) {
|
||||
$hrXML = new XMLBranch("hr");
|
||||
$bodyXML->addXMLBranch($hrXML);
|
||||
$pMethodXML = new XMLBranch("p");
|
||||
$aMethodXML = new XMLBranch("a");
|
||||
$aMethodXML->setTagAttribute("name", $methodName);
|
||||
$spanXMLName = new XMLBranch("span");
|
||||
$spanXMLName->setTagAttribute("class", "methodName");
|
||||
$spanXMLName->setTagContent($methodName);
|
||||
$spanXMLArgs = new XMLBranch("span");
|
||||
$tagContentArgs = " ( ";
|
||||
if(is_array($method->params) && count($method->params) > 0) {
|
||||
$paramCount = 0;
|
||||
foreach($method->params as $key => $value) {
|
||||
if($paramCount > 0)
|
||||
$tagContentArgs .= ", ";
|
||||
$tagContentArgs .= $key;
|
||||
$paramCount ++;
|
||||
}
|
||||
}
|
||||
$tagContentArgs .= " )";
|
||||
$spanXMLArgs->setTagContent($tagContentArgs);
|
||||
$aMethodXML->addXMLBranch($spanXMLName);
|
||||
$aMethodXML->addXMLBranch($spanXMLArgs);
|
||||
$pMethodXML->addXMLBranch($aMethodXML);
|
||||
$bodyXML->addXMLBranch($pMethodXML);
|
||||
unset($method->info["name"]);
|
||||
foreach($method->info as $infoKey => $infoValue) {
|
||||
if(is_array($infoValue)) {
|
||||
$pXML = new XMLBranch("p");
|
||||
$pXML->setTagAttribute("class", $infoKey);
|
||||
$pXML->setTagContent(ucfirst($infoKey) . ":");
|
||||
$ulXML = new XMLBranch("ul");
|
||||
$ulXML->setTagAttribute("class", $infoKey);
|
||||
foreach($infoValue as $value) {
|
||||
$liXML = new XMLBranch("li");
|
||||
$liXML->setTagContent($value);
|
||||
$ulXML->addXMLBranch($liXML);
|
||||
}
|
||||
$bodyXML->addXMLBranch($pXML);
|
||||
$bodyXML->addXMLBranch($ulXML);
|
||||
}
|
||||
else {
|
||||
$pXML = new XMLBranch("p");
|
||||
$pXML->setTagAttribute("class", $infoKey);
|
||||
$pXML->setTagContent(ucfirst($infoKey) . ": " . $infoValue);
|
||||
$bodyXML->addXMLBranch($pXML);
|
||||
}
|
||||
}
|
||||
if(is_array($method->params) && count($method->params) > 0) {
|
||||
$pParamXML = new XMLBranch("p");
|
||||
//$pParamXML->setTagAttribute("class", "param");
|
||||
$paramTitleXML = new XMLBranch("span");
|
||||
$paramTitleXML->setTagContent("Arguments:");
|
||||
$pParamXML->addXMLBranch($paramTitleXML);
|
||||
$paramListXML = new XMLBranch("ul");
|
||||
foreach($method->params as $key => $value) {
|
||||
$paramItemXML = new XMLBranch("li");
|
||||
$paramItemXML->setTagAttribute("class", "param");
|
||||
$paramItemXML->setTagContent($key);
|
||||
$paramListXML->addXMLBranch($paramItemXML);
|
||||
}
|
||||
$pParamXML->addXMLBranch($paramListXML);
|
||||
$bodyXML->addXMLBranch($pParamXML);
|
||||
}
|
||||
}
|
||||
// ---------------------- END ---------------------- //
|
||||
$classDocXML->addXMLBranch($headXML);
|
||||
$classDocXML->addXMLBranch($bodyXML);
|
||||
return $classDocXML->getXMLString(0);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns class documentation as a string, formatted in HTML
|
||||
* @method getClassDocFromFile
|
||||
* @param string filename
|
||||
* @returns string HTML-formatted documentation if successful, false otherwise
|
||||
*/
|
||||
function getClassDocFromFile($filename) {
|
||||
if(is_string($filename) && file_exists($filename) && is_readable($filename)) {
|
||||
$objClass = new PHPClass($filename);
|
||||
return $this->getClassDocFromClass($objClass);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
83
thirdparty/wizard/org/active-link/doc/Method.php
vendored
83
thirdparty/wizard/org/active-link/doc/Method.php
vendored
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
This file is part of ActiveLink PHP DOC Package (www.active-link.com).
|
||||
Copyright (c) 2002-2004 by Zurab Davitiani
|
||||
|
||||
You can contact the author of this software via E-mail at
|
||||
hattrick@mailcan.com
|
||||
|
||||
ActiveLink PHP DOC Package is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ActiveLink PHP DOC Package is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ActiveLink PHP DOC Package; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Method class complements PHPClass and is used to define a class method
|
||||
* @class Method
|
||||
* @package org.active-link.doc
|
||||
* @author Zurab Davitiani
|
||||
* @version 0.3.4
|
||||
* @see PHPClass
|
||||
*/
|
||||
|
||||
class Method {
|
||||
|
||||
var $params;
|
||||
var $info;
|
||||
|
||||
/**
|
||||
* Constructor, runs when new object instance is created, sets name of the method
|
||||
* @method Method
|
||||
* @param string name
|
||||
*/
|
||||
function Method($name) {
|
||||
$this->info = array();
|
||||
$this->params = array();
|
||||
$this->setInfo("name", $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns value of a property by name
|
||||
* @method getInfo
|
||||
* @param string name
|
||||
* @returns string value of a property if found, false otherwise
|
||||
*/
|
||||
function getInfo($name) {
|
||||
if(array_key_exists($name, $this->info))
|
||||
return $this->info[$name];
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a property with supplied name to a supplied value
|
||||
* @method setInfo
|
||||
* @param string name, string value
|
||||
* @returns none
|
||||
*/
|
||||
function setInfo($name, $value) {
|
||||
$this->info[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a parameter with supplied name and value
|
||||
* @method setParam
|
||||
* @param string name, string value
|
||||
* @returns none
|
||||
*/
|
||||
function setParam($name, $value) {
|
||||
$this->params[$name] = $value;
|
||||
}
|
||||
|
||||
}
|
||||
195
thirdparty/wizard/org/active-link/doc/PHPClass.php
vendored
195
thirdparty/wizard/org/active-link/doc/PHPClass.php
vendored
@@ -1,195 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
This file is part of ActiveLink PHP DOC Package (www.active-link.com).
|
||||
Copyright (c) 2002-2004 by Zurab Davitiani
|
||||
|
||||
You can contact the author of this software via E-mail at
|
||||
hattrick@mailcan.com
|
||||
|
||||
ActiveLink PHP DOC Package is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ActiveLink PHP DOC Package is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ActiveLink PHP DOC Package; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPClass class provides a structural definition for a class
|
||||
* @class PHPClass
|
||||
* @package org.active-link.doc
|
||||
* @author Zurab Davitiani
|
||||
* @version 0.3.4
|
||||
* @requires Method
|
||||
* @see PHPClass
|
||||
*/
|
||||
|
||||
class PHPClass {
|
||||
|
||||
var $methods;
|
||||
var $properties;
|
||||
var $info;
|
||||
|
||||
/**
|
||||
* Constructor, if filename is supplied parses the file into the object
|
||||
* @method PHPClass
|
||||
* @param optional string filename
|
||||
* @returns none
|
||||
*/
|
||||
function PHPClass($filename = "") {
|
||||
$this->methods = array();
|
||||
$this->properties = array();
|
||||
$this->info = array();
|
||||
if($filename != "")
|
||||
$this->parseFromFile($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a property by name
|
||||
* @method deleteInfo
|
||||
* @param string name
|
||||
* @returns true if successful, false otherwise
|
||||
*/
|
||||
function deleteInfo($name) {
|
||||
$success = false;
|
||||
if(array_key_exists($name, $this->info)) {
|
||||
unset($this->info[$name]);
|
||||
$success = true;
|
||||
}
|
||||
return $success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a property value by name
|
||||
* @method getInfo
|
||||
* @param string name
|
||||
* @returns string value if successful, false otherwise
|
||||
*/
|
||||
function getInfo($name) {
|
||||
if(array_key_exists($name, $this->info))
|
||||
return $this->info[$name];
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a class from supplied filename
|
||||
* @method parseFromFile
|
||||
* @param string filename
|
||||
* @returns true if successful, false otherwise
|
||||
*/
|
||||
function parseFromFile($filename) {
|
||||
$success = false;
|
||||
if(file_exists($filename) && is_readable($filename)) {
|
||||
$arrContents = file($filename);
|
||||
$parsing = false;
|
||||
$parsingBlocks = array();
|
||||
$tempBlock = array();
|
||||
foreach($arrContents as $line) {
|
||||
if(trim($line) == "/**") {
|
||||
$parsing = true;
|
||||
$blockstart = true;
|
||||
}
|
||||
elseif($parsing && trim($line) == "*/") {
|
||||
$parsing = false;
|
||||
$parsingBlocks[] = $tempBlock;
|
||||
$tempBlock = array();
|
||||
}
|
||||
else {
|
||||
if($parsing) {
|
||||
if($blockstart) {
|
||||
$tempBlock[] = $line;
|
||||
$blockstart = false;
|
||||
}
|
||||
else {
|
||||
$tempBlock[] = $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach($parsingBlocks as $blockLines) {
|
||||
$block = array();
|
||||
foreach($blockLines as $line) {
|
||||
$str = strstr($line, "@");
|
||||
$str = substr($str, 1);
|
||||
if($str !== false) {
|
||||
$separatorPos = (strpos($str, " ") && strpos($str, "\t")) ? min(strpos($str, " "), strpos($str, "\t")) : (strpos($str, " ") ? strpos($str, " ") : (strpos($str, "\t") ? strpos($str, "\t") : strlen($str)));
|
||||
$name = trim(substr($str, 0, $separatorPos));
|
||||
$value = trim(substr($str, $separatorPos));
|
||||
}
|
||||
else {
|
||||
$name = "description";
|
||||
$value = trim($line);
|
||||
}
|
||||
if($name == "param" || $name == "description")
|
||||
$block[$name][] = $value;
|
||||
else
|
||||
$block[$name] = $value;
|
||||
}
|
||||
//print("<pre>");
|
||||
//print_r($block);
|
||||
//print("</pre>");
|
||||
if(array_key_exists("method", $block)) {
|
||||
$tempMethod = new Method($block["method"]);
|
||||
unset($block["method"]);
|
||||
if(isset($block["param"]) && is_array($block["param"])) {
|
||||
foreach($block["param"] as $param) {
|
||||
$tempMethod->setParam($param, "");
|
||||
}
|
||||
}
|
||||
unset($block["param"]);
|
||||
foreach($block as $name => $value) {
|
||||
$tempMethod->setInfo($name, $value);
|
||||
}
|
||||
$this->setMethod($tempMethod);
|
||||
}
|
||||
elseif(array_key_exists("class", $block)) {
|
||||
$this->setInfo("name", $block["class"]);
|
||||
unset($block["class"]);
|
||||
foreach($block as $name => $value) {
|
||||
$this->setInfo($name, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
$success = true;
|
||||
}
|
||||
return $success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a property by name
|
||||
* @method setInfo
|
||||
* @param string name, string value
|
||||
* @returns none
|
||||
*/
|
||||
function setInfo($name, $value) {
|
||||
$this->info[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a method to the class definition
|
||||
* @method setMethod
|
||||
* @param object method
|
||||
* @returns true if successful, false otherwise
|
||||
*/
|
||||
function setMethod($method) {
|
||||
$success = false;
|
||||
if(is_object($method) && get_class($method) == "Method") {
|
||||
$this->methods[$method->getInfo("name")] = $method;
|
||||
$success = true;
|
||||
}
|
||||
return $success;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\PHPReflectionClass\ClassStructure;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
class TriggerLibrary
|
||||
@@ -105,14 +107,13 @@ class TriggerLibrary
|
||||
* getMethodsFromLibraryFile
|
||||
*
|
||||
* @param string $file
|
||||
* @return object(PHPClass) $parsedLibrary
|
||||
* @return ClassStructure $parsedLibrary
|
||||
*/
|
||||
public function getMethodsFromLibraryFile($file)
|
||||
{
|
||||
// parse class comments from file
|
||||
$parsedLibrary = new PHPClass();
|
||||
$parsedLibrary = new ClassStructure();
|
||||
$success = $parsedLibrary->parseFromFile($file);
|
||||
|
||||
return $parsedLibrary;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\PHPReflectionClass;
|
||||
|
||||
use ReflectionClass;
|
||||
|
||||
/**
|
||||
* Structure for the metadata of the class.
|
||||
*/
|
||||
class ClassStructure
|
||||
{
|
||||
/**
|
||||
* Array of methods.
|
||||
* @var array
|
||||
*/
|
||||
public $methods;
|
||||
|
||||
/**
|
||||
* Array of properties.
|
||||
* @var array
|
||||
*/
|
||||
public $properties;
|
||||
|
||||
/**
|
||||
* Array of informations.
|
||||
* @var array
|
||||
*/
|
||||
public $info;
|
||||
|
||||
/**
|
||||
* Constructor of the class, require the path of source code.
|
||||
* @param string $filename
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(string $filename = "")
|
||||
{
|
||||
$this->methods = [];
|
||||
$this->properties = [];
|
||||
$this->info = [];
|
||||
if ($filename != "") {
|
||||
$this->parseFromFile($filename);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a property by name.
|
||||
* @param string $name
|
||||
* @return boolean
|
||||
*/
|
||||
public function deleteInfo(string $name): bool
|
||||
{
|
||||
if (array_key_exists($name, $this->info)) {
|
||||
unset($this->info[$name]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a property value by name.
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function getInfo(string $name)
|
||||
{
|
||||
if (array_key_exists($name, $this->info)) {
|
||||
return $this->info[$name];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a property by name.
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function setInfo(string $name, string $value): void
|
||||
{
|
||||
$this->info[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a method to the class definition.
|
||||
* @param type $method
|
||||
* @return bool
|
||||
*/
|
||||
public function setMethod($method): bool
|
||||
{
|
||||
if (is_object($method) && (new ReflectionClass($method))->getShortName() == "MethodStructure") {
|
||||
$this->methods[$method->getInfo("name")] = $method;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a source code, require a filename.
|
||||
* @param string $filename
|
||||
* @return bool
|
||||
*/
|
||||
public function parseFromFile(string $filename): bool
|
||||
{
|
||||
if (file_exists($filename) && is_readable($filename)) {
|
||||
$arrContents = file($filename);
|
||||
$parsing = false;
|
||||
$parsingBlocks = [];
|
||||
$tempBlock = [];
|
||||
foreach ($arrContents as $line) {
|
||||
if (trim($line) == "/**") {
|
||||
$parsing = true;
|
||||
$blockstart = true;
|
||||
} elseif ($parsing && trim($line) == "*/") {
|
||||
$parsing = false;
|
||||
$parsingBlocks[] = $tempBlock;
|
||||
$tempBlock = [];
|
||||
} else {
|
||||
if ($parsing) {
|
||||
if ($blockstart) {
|
||||
$tempBlock[] = $line;
|
||||
$blockstart = false;
|
||||
} else {
|
||||
$tempBlock[] = $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($parsingBlocks as $blockLines) {
|
||||
$block = [];
|
||||
foreach ($blockLines as $line) {
|
||||
$str = strstr($line, "@");
|
||||
$str = substr($str, 1);
|
||||
if ($str !== false) {
|
||||
$separatorPos = (strpos($str, " ") && strpos($str, "\t")) ? min(strpos($str, " "), strpos($str, "\t")) : (strpos($str, " ") ? strpos($str, " ") : (strpos($str, "\t") ? strpos($str, "\t") : strlen($str)));
|
||||
$name = trim(substr($str, 0, $separatorPos));
|
||||
$value = trim(substr($str, $separatorPos));
|
||||
} else {
|
||||
$name = "description";
|
||||
$value = trim($line);
|
||||
}
|
||||
if ($name == "param" || $name == "description")
|
||||
$block[$name][] = $value;
|
||||
else
|
||||
$block[$name] = $value;
|
||||
}
|
||||
if (array_key_exists("method", $block)) {
|
||||
$tempMethod = new MethodStructure($block["method"]);
|
||||
unset($block["method"]);
|
||||
if (isset($block["param"]) && is_array($block["param"])) {
|
||||
foreach ($block["param"] as $param) {
|
||||
$tempMethod->setParam($param, "");
|
||||
}
|
||||
}
|
||||
unset($block["param"]);
|
||||
foreach ($block as $name => $value) {
|
||||
$tempMethod->setInfo($name, $value);
|
||||
}
|
||||
$this->setMethod($tempMethod);
|
||||
} elseif (array_key_exists("class", $block)) {
|
||||
$this->setInfo("name", $block["class"]);
|
||||
unset($block["class"]);
|
||||
foreach ($block as $name => $value) {
|
||||
$this->setInfo($name, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\PHPReflectionClass;
|
||||
|
||||
/**
|
||||
* Structure for the metadata of the class method.
|
||||
*/
|
||||
class MethodStructure
|
||||
{
|
||||
/**
|
||||
* Params property.
|
||||
* @var array
|
||||
*/
|
||||
public $params;
|
||||
|
||||
/**
|
||||
* Information property.
|
||||
* @var array
|
||||
*/
|
||||
public $info;
|
||||
|
||||
/**
|
||||
* Constructor, runs when new object instance is created, sets name of the method.
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(string $name)
|
||||
{
|
||||
$this->info = [];
|
||||
$this->params = [];
|
||||
$this->setInfo("name", $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value of a property by name.
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function getInfo(string $name)
|
||||
{
|
||||
if (array_key_exists($name, $this->info)) {
|
||||
return $this->info[$name];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a property with supplied name to a supplied value.
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function setInfo(string $name, string $value): void
|
||||
{
|
||||
$this->info[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a parameter with supplied name and value.
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function setParam(string $name, string $value): void
|
||||
{
|
||||
$this->params[$name] = $value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user