li').bind('mouseover', menu_open);
28 | $('#file-nav > li').bind('mouseout', menu_timer);
29 | });
30 |
31 | document.onclick = menu_close;
--------------------------------------------------------------------------------
/docs/js/prettify/lang-apollo.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProdigyView-Toolkit/prodigyview/a3b209a643d3b5a1c833c7734bfc5a56106f0244/docs/js/prettify/lang-apollo.js
--------------------------------------------------------------------------------
/docs/js/prettify/lang-clj.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2011 Google Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | var a=null;
17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^[([{]+/,a,"([{"],["clo",/^[)\]}]+/,a,")]}"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \xa0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/,a],
18 | ["typ",/^:[\dA-Za-z-]+/]]),["clj"]);
19 |
--------------------------------------------------------------------------------
/docs/js/prettify/lang-css.js:
--------------------------------------------------------------------------------
1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com",
2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);
3 |
--------------------------------------------------------------------------------
/docs/js/prettify/lang-go.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProdigyView-Toolkit/prodigyview/a3b209a643d3b5a1c833c7734bfc5a56106f0244/docs/js/prettify/lang-go.js
--------------------------------------------------------------------------------
/docs/js/prettify/lang-hs.js:
--------------------------------------------------------------------------------
1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n\r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["str",/^'(?:[^\n\f\r'\\]|\\[^&])'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:--+[^\n\f\r]*|{-(?:[^-]|-+[^}-])*-})/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^\d'A-Za-z]|$)/,
2 | null],["pln",/^(?:[A-Z][\w']*\.)*[A-Za-z][\w']*/],["pun",/^[^\d\t-\r "'A-Za-z]+/]]),["hs"]);
3 |
--------------------------------------------------------------------------------
/docs/js/prettify/lang-lisp.js:
--------------------------------------------------------------------------------
1 | var a=null;
2 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,a,"("],["clo",/^\)+/,a,")"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \xa0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,a],
3 | ["lit",/^[+-]?(?:[#0]x[\da-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[de][+-]?\d+)?)/i],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[_a-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/i],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["cl","el","lisp","scm"]);
4 |
--------------------------------------------------------------------------------
/docs/js/prettify/lang-lua.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProdigyView-Toolkit/prodigyview/a3b209a643d3b5a1c833c7734bfc5a56106f0244/docs/js/prettify/lang-lua.js
--------------------------------------------------------------------------------
/docs/js/prettify/lang-ml.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProdigyView-Toolkit/prodigyview/a3b209a643d3b5a1c833c7734bfc5a56106f0244/docs/js/prettify/lang-ml.js
--------------------------------------------------------------------------------
/docs/js/prettify/lang-n.js:
--------------------------------------------------------------------------------
1 | var a=null;
2 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:'(?:[^\n\r'\\]|\\.)*'|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,a,'"'],["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,a,"#"],["pln",/^\s+/,a," \r\n\t\xa0"]],[["str",/^@"(?:[^"]|"")*(?:"|$)/,a],["str",/^<#[^#>]*(?:#>|$)/,a],["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,a],["com",/^\/\/[^\n\r]*/,a],["com",/^\/\*[\S\s]*?(?:\*\/|$)/,
3 | a],["kwd",/^(?:abstract|and|as|base|catch|class|def|delegate|enum|event|extern|false|finally|fun|implements|interface|internal|is|macro|match|matches|module|mutable|namespace|new|null|out|override|params|partial|private|protected|public|ref|sealed|static|struct|syntax|this|throw|true|try|type|typeof|using|variant|virtual|volatile|when|where|with|assert|assert2|async|break|checked|continue|do|else|ensures|for|foreach|if|late|lock|new|nolate|otherwise|regexp|repeat|requires|return|surroundwith|unchecked|unless|using|while|yield)\b/,
4 | a],["typ",/^(?:array|bool|byte|char|decimal|double|float|int|list|long|object|sbyte|short|string|ulong|uint|ufloat|ulong|ushort|void)\b/,a],["lit",/^@[$_a-z][\w$@]*/i,a],["typ",/^@[A-Z]+[a-z][\w$@]*/,a],["pln",/^'?[$_a-z][\w$@]*/i,a],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,a,"0123456789"],["pun",/^.[^\s\w"-$'./@`]*/,a]]),["n","nemerle"]);
5 |
--------------------------------------------------------------------------------
/docs/js/prettify/lang-proto.js:
--------------------------------------------------------------------------------
1 | PR.registerLangHandler(PR.sourceDecorator({keywords:"bytes,default,double,enum,extend,extensions,false,group,import,max,message,option,optional,package,repeated,required,returns,rpc,service,syntax,to,true",types:/^(bool|(double|s?fixed|[su]?int)(32|64)|float|string)\b/,cStyleComments:!0}),["proto"]);
2 |
--------------------------------------------------------------------------------
/docs/js/prettify/lang-scala.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProdigyView-Toolkit/prodigyview/a3b209a643d3b5a1c833c7734bfc5a56106f0244/docs/js/prettify/lang-scala.js
--------------------------------------------------------------------------------
/docs/js/prettify/lang-sql.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProdigyView-Toolkit/prodigyview/a3b209a643d3b5a1c833c7734bfc5a56106f0244/docs/js/prettify/lang-sql.js
--------------------------------------------------------------------------------
/docs/js/prettify/lang-tex.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProdigyView-Toolkit/prodigyview/a3b209a643d3b5a1c833c7734bfc5a56106f0244/docs/js/prettify/lang-tex.js
--------------------------------------------------------------------------------
/docs/js/prettify/lang-vb.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProdigyView-Toolkit/prodigyview/a3b209a643d3b5a1c833c7734bfc5a56106f0244/docs/js/prettify/lang-vb.js
--------------------------------------------------------------------------------
/docs/js/prettify/lang-vhdl.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProdigyView-Toolkit/prodigyview/a3b209a643d3b5a1c833c7734bfc5a56106f0244/docs/js/prettify/lang-vhdl.js
--------------------------------------------------------------------------------
/docs/js/prettify/lang-wiki.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProdigyView-Toolkit/prodigyview/a3b209a643d3b5a1c833c7734bfc5a56106f0244/docs/js/prettify/lang-wiki.js
--------------------------------------------------------------------------------
/docs/js/prettify/lang-yaml.js:
--------------------------------------------------------------------------------
1 | var a=null;
2 | PR.registerLangHandler(PR.createSimpleLexer([["pun",/^[:>?|]+/,a,":|>?"],["dec",/^%(?:YAML|TAG)[^\n\r#]+/,a,"%"],["typ",/^&\S+/,a,"&"],["typ",/^!\S*/,a,"!"],["str",/^"(?:[^"\\]|\\.)*(?:"|$)/,a,'"'],["str",/^'(?:[^']|'')*(?:'|$)/,a,"'"],["com",/^#[^\n\r]*/,a,"#"],["pln",/^\s+/,a," \t\r\n"]],[["dec",/^(?:---|\.\.\.)(?:[\n\r]|$)/],["pun",/^-/],["kwd",/^\w+:[\n\r ]/],["pln",/^\w+/]]),["yaml","yml"]);
3 |
--------------------------------------------------------------------------------
/docs/js/sidebar.js:
--------------------------------------------------------------------------------
1 | jQuery.expr[':'].Contains = function(a, i, m) {
2 | return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
3 | };
4 |
5 | $(function() {
6 | $("#sidebar-nav").accordion({
7 | autoHeight: false,
8 | navigation: true,
9 | collapsible: true
10 | }).accordion("activate", false)
11 | .find('a.link').unbind('click').click(
12 | function(ev) {
13 | ev.cancelBubble = true; // IE
14 | if (ev.stopPropagation) {
15 | ev.stopPropagation(); // the rest
16 | }
17 |
18 | return true;
19 | }).prev().prev().remove();
20 |
21 | $("#sidebar-nav>h3").click(function() {
22 | if ($(this).attr('initialized') == 'true') return;
23 |
24 | $(this).next().find(".sidebar-nav-tree").treeview({
25 | collapsed: true,
26 | persist: "cookie"
27 | });
28 | $(this).attr('initialized', true);
29 | });
30 | });
31 |
32 | function tree_search(input) {
33 | treeview = $(input).parent().parent().next();
34 |
35 | // Expand all items
36 | treeview.find('.expandable-hitarea').click();
37 |
38 | // make all items visible again
39 | treeview.find('li:hidden').show();
40 |
41 | // hide all items that do not match the given search criteria
42 | if ($(input).val()) {
43 | treeview.find('li').not(':has(a:Contains(' + $(input).val() + '))').hide();
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/docs/phpdoc-cache-2e/phpdoc-cache-settings.dat:
--------------------------------------------------------------------------------
1 | O:51:"phpDocumentor\Descriptor\ProjectDescriptor\Settings":2:{s:13:" * isModified";b:0;s:13:" * visibility";i:7;}
--------------------------------------------------------------------------------
/docs/phpdoc-cache-5e/phpdoc-cache-file_43850104a78e91196abf2dc9f011053a.dat:
--------------------------------------------------------------------------------
1 | O:39:"phpDocumentor\Descriptor\FileDescriptor":22:{s:7:" * hash";s:32:"ada0129f7e803efa176832793ac27e9d";s:7:" * path";s:23:"_BootCoreComponents.php";s:9:" * source";s:1591:" false));
33 | ";s:19:" * namespaceAliases";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * includes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:41:"phpDocumentor\Reflection\IncludeReflector":3:{s:7:" * node";O:28:"PhpParser\Node\Expr\Include_":4:{s:4:"expr";O:29:"PhpParser\Node\Scalar\String_":3:{s:5:"value";s:16:"_classLoader.php";s:36:" PhpParser\NodeAbstract subNodeNames";N;s:13:" * attributes";a:3:{s:9:"startLine";i:30;s:7:"endLine";i:30;s:13:"originalValue";s:18:"'_classLoader.php'";}}s:4:"type";i:1;s:36:" PhpParser\NodeAbstract subNodeNames";N;s:13:" * attributes";a:3:{s:8:"comments";a:0:{}s:9:"startLine";i:30;s:7:"endLine";i:30;}}s:23:" * default_package_name";s:0:"";s:10:" * context";O:41:"phpDocumentor\Reflection\DocBlock\Context":3:{s:12:" * namespace";s:0:"";s:20:" * namespace_aliases";a:0:{}s:7:" * lsen";s:0:"";}}}}s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * functions";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * classes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:13:" * interfaces";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * traits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * markers";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:0:"";s:7:" * name";s:21:"_BootMinusPlugins.php";s:12:" * namespace";N;s:10:" * package";s:7:"Default";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:" * name";s:7:"package";s:14:" * description";s:7:"Default";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50000";s:7:" * line";i:0;s:10:" * context";a:2:{s:11:"{{ value }}";s:2:"""";i:0;s:0:"";}}}}s:19:" * inheritedElement";N;}
--------------------------------------------------------------------------------
/docs/phpdoc-cache-8f/phpdoc-cache-file_dfa1418312684d8aea54735f25f5a913.dat:
--------------------------------------------------------------------------------
1 | O:39:"phpDocumentor\Descriptor\FileDescriptor":22:{s:7:" * hash";s:32:"2f055fa2b951f317768c5fed65733dfc";s:7:" * path";s:22:"_BootMinusDatabase.php";s:9:" * source";s:1675:" false, 'load_database' => false));
32 | ";s:19:" * namespaceAliases";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * includes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:41:"phpDocumentor\Reflection\IncludeReflector":3:{s:7:" * node";O:28:"PhpParser\Node\Expr\Include_":4:{s:4:"expr";O:29:"PhpParser\Node\Scalar\String_":3:{s:5:"value";s:16:"_classLoader.php";s:36:" PhpParser\NodeAbstract subNodeNames";N;s:13:" * attributes";a:3:{s:9:"startLine";i:30;s:7:"endLine";i:30;s:13:"originalValue";s:18:"'_classLoader.php'";}}s:4:"type";i:1;s:36:" PhpParser\NodeAbstract subNodeNames";N;s:13:" * attributes";a:3:{s:8:"comments";a:0:{}s:9:"startLine";i:30;s:7:"endLine";i:30;}}s:23:" * default_package_name";s:0:"";s:10:" * context";O:41:"phpDocumentor\Reflection\DocBlock\Context":3:{s:12:" * namespace";s:0:"";s:20:" * namespace_aliases";a:0:{}s:7:" * lsen";s:0:"";}}}}s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * functions";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * classes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:13:" * interfaces";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * traits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * markers";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:0:"";s:7:" * name";s:22:"_BootMinusDatabase.php";s:12:" * namespace";N;s:10:" * package";s:7:"Default";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:" * name";s:7:"package";s:14:" * description";s:7:"Default";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50000";s:7:" * line";i:0;s:10:" * context";a:2:{s:11:"{{ value }}";s:2:"""";i:0;s:0:"";}}}}s:19:" * inheritedElement";N;}
--------------------------------------------------------------------------------
/docs/phpdoc-cache-c9/phpdoc-cache-file_fb95e8f891522a0c0b26a2831bf34030.dat:
--------------------------------------------------------------------------------
1 | O:39:"phpDocumentor\Descriptor\FileDescriptor":22:{s:7:" * hash";s:32:"399f3009d1445b31c4bafa03bbc38e8c";s:7:" * path";s:23:"_BootCompleteSystem.php";s:9:" * source";s:1620:" false, 'load_database' => false));
32 |
--------------------------------------------------------------------------------
/src/_classLoader.php:
--------------------------------------------------------------------------------
1 | &$arg) {
52 | $passable_args[$key] = &$arg;
53 | }
54 |
55 | if ($this->_hasAdapter(get_called_class(), __FUNCTION__))
56 | return $this->_callAdapter(get_called_class(), __FUNCTION__, $command, $passable_args);
57 |
58 | $filtered = $this->_applyFilter(get_called_class(), __FUNCTION__, array(
59 | 'command' => $command,
60 | 'passable_args' => $passable_args
61 | ), array('event' => 'args'));
62 |
63 | $command = $filtered['command'];
64 | $passable_args = $filtered['passable_args'];
65 |
66 | if (method_exists($this, $command)) {
67 | $value = $this->_invokeMethod($this, $command, $passable_args);
68 | } else {
69 | $value = $this->_invokeMethod($this, 'defaultFunction', $passable_args);
70 | }
71 |
72 | $this->_notify(get_called_class() . '::' . __FUNCTION__, $value, $command, $passable_args);
73 | $value = $this->_applyFilter(get_called_class(), __FUNCTION__, $value, array('event' => 'return'));
74 |
75 | return $value;
76 | }
77 |
78 | /**
79 | * The default function and abstract that must be implemented. If the commandIntepreter cannot find a
80 | * correspoding function, this function will be called.
81 | */
82 | abstract function defaultFunction($params = array());
83 |
84 | }//end class
85 |
--------------------------------------------------------------------------------
/src/design/Invoke.php:
--------------------------------------------------------------------------------
1 | {$method}();
26 | break;
27 | case 1 :
28 | return $class->{$method}($args[0]);
29 | break;
30 | case 2 :
31 | return $class->{$method}($args[0], $args[1]);
32 | break;
33 | case 3 :
34 | return $class->{$method}($args[0], $args[1], $args[2]);
35 | break;
36 | case 4 :
37 | return $class->{$method}($args[0], $args[1], $args[2], $args[3]);
38 | break;
39 | case 5 :
40 | return $class->{$method}($args[0], $args[1], $args[2], $args[3], $args[4]);
41 | break;
42 | default :
43 | return call_user_func_array(array(
44 | $class,
45 | $method
46 | ), $args);
47 | break;
48 | endswitch;
49 |
50 | }//end _invokeMethod
51 |
52 | /**
53 | * Calls a methods that is a method of a class. This method is generally
54 | * faster than using user_call_func_array.
55 | *
56 | * @param string $class The name of the class to be called
57 | * @param string $method The name of the method in the class to be called
58 | * @param array $args An array of arguements. Arguements have to be embedded in an array to be
59 | * called.
60 | *
61 | * @return mixed $data Data returned by the function called
62 | * @access protected
63 | */
64 | protected function _invokeStaticMethod($class, $method, $args) {
65 |
66 | switch(count($args)) :
67 | case 0 :
68 | return $class::$method();
69 | break;
70 | case 1 :
71 | return $class::$method($args[0]);
72 | break;
73 | case 2 :
74 | return $class::$method($args[0], $args[1]);
75 | break;
76 | case 3 :
77 | return $class::$method($args[0], $args[1], $args[2]);
78 | break;
79 | case 4 :
80 | return $class::$method($args[0], $args[1], $args[2], $args[3]);
81 | break;
82 | case 5 :
83 | return $class::$method($args[0], $args[1], $args[2], $args[3], $args[4]);
84 | break;
85 | default :
86 | return call_user_func_array(array(
87 | $class,
88 | $method
89 | ), $args);
90 | break;
91 | endswitch;
92 |
93 | }//end _invokeMethod
94 |
95 | /**
96 | * Breaks down the data to be logged from an adapter, filter or observer.
97 | *
98 | * @param array $data
99 | *
100 | * @return string $message JSON encode message of information about the data
101 | * @access private
102 | */
103 | protected function _prepareLogData($data) {
104 |
105 | foreach ($data as $key => $value) {
106 | if ($value instanceof Closure) {
107 | $closure = new \ReflectionFunction($value);
108 | $data[$key] = $closure->getFileName();
109 | $data['start_line'] = $closure->getStartLine();
110 | $data['end_line'] = $closure->getEndLine();
111 | } else if (is_object($value)) {
112 | $object = new \ReflectionClass($value);
113 | $data[$key] = $object->getFileName();
114 | $data['start_line'] = $object->getStartLine();
115 | $data['end_line'] = $object->getEndLine();
116 | } else if (!is_string($value)) {
117 | unset($data[$key]);
118 | }
119 |
120 | }
121 |
122 | return json_encode($data);
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/src/design/Observer.php:
--------------------------------------------------------------------------------
1 | 'static',
43 | 'class' => $class,
44 | 'method' => $method,
45 | 'type' => 'class_method'
46 | );
47 |
48 | $options += $default;
49 | $this->_observers[$event][] = $options;
50 | }//end _addObersver
51 |
52 | /**
53 | * Calls any functions that have been added to the observer if the event is present in the
54 | * observers array.
55 | *
56 | * @param string $event The name of the event that will trigger notifiers
57 | * @param mixed $args An array of infinite arguements that will passed to each function related to
58 | * the event
59 | *
60 | * @return void
61 | * @access protected
62 | */
63 | protected function _notify(string $event) {
64 |
65 | $args = func_get_args();
66 | array_shift($args);
67 |
68 | $passable_args = array();
69 | foreach ($args as $key => &$arg) {
70 | $passable_args[$key] = &$arg;
71 | }
72 |
73 | if (isset($this->_observers[$event])) {
74 | foreach ($this->_observers[$event] as $options) {
75 |
76 | if ($this->_traceObservers) {
77 | $trace = debug_backtrace();
78 | $options['trace'] = $trace[1]['class'] . '::' . $trace[1]['function'];
79 | $this->_logObserver($options);
80 | }
81 |
82 | if ($options['type'] === 'closure')
83 | call_user_func_array($options['method'], $passable_args);
84 | else if ($options['type'] === 'instance')
85 | $this->_invokeMethod($options['class'], $options['method'], $passable_args);
86 | else
87 | $this->_invokeStaticMethod($options['class'], $options['method'], $passable_args);
88 | }//end for each
89 | }
90 |
91 | }//end _notify
92 |
93 | /**
94 | * Removes all the observers assoicated with an event.
95 | *
96 | * @param string $event The event to remove all the observers from
97 | *
98 | * @return void
99 | * @access public
100 | */
101 | public function clearObservers(string $event) {
102 | unset($this->_observers[$event]);
103 | }
104 |
105 | /**
106 | * Turn on/off the ability to trace an observer.Turning on will log
107 | * an observer using Log when the observer is executed.
108 | *
109 | * @param boolean $trace Default is false. If set to true, will trace observer.
110 | *
111 | * @return void
112 | * @access public
113 | */
114 | public function setObserverTrace(bool $trace = false) {
115 | $this->_traceObservers = $trace;
116 | }
117 |
118 | /**
119 | * Write out the contents of an observer to a log.
120 | *
121 | * @param array $data The data in the observer
122 | *
123 | * @return void
124 | * @access private
125 | */
126 | protected function _logObserver(array $data) {
127 |
128 | $message = $this->_prepareLogData($data);
129 | Log::writeLog('observer', $message);
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/src/design/Singleton.php:
--------------------------------------------------------------------------------
1 | &$arg) {
53 | $passable_args[$key] = &$arg;
54 | }
55 |
56 | if (self::_hasAdapter(get_called_class(), __FUNCTION__))
57 | return self::_callAdapter(get_called_class(), __FUNCTION__, $command, $passable_args);
58 |
59 | $filtered = self::_applyFilter(get_called_class(), __FUNCTION__, array(
60 | 'command' => $command,
61 | 'passable_args' => $passable_args
62 | ), array('event' => 'args'));
63 |
64 | $command = $filtered['command'];
65 | $passable_args = $filtered['passable_args'];
66 |
67 | if (method_exists($this, $command)) {
68 | $value = self::_invokeMethod($this, $command, $passable_args);
69 | } else {
70 | $value = self::_invokeMethod($this, 'defaultFunction', $passable_args);
71 | }
72 |
73 | self::_notify(get_called_class() . '::' . __FUNCTION__, $value, $command, $passable_args);
74 | $value = self::_applyFilter(get_called_class(), __FUNCTION__, $value, array('event' => 'return'));
75 |
76 | return $value;
77 | }
78 |
79 | /**
80 | * The default function that must be implemented. If the commandIntepreter cannot find a correspoding
81 | * function, this function will be called.
82 | */
83 | abstract function defaultFunction($params = array());
84 |
85 | }//end class
86 |
--------------------------------------------------------------------------------
/src/design/StaticInvoke.php:
--------------------------------------------------------------------------------
1 | {$method}();
25 | break;
26 | case 1 :
27 | return $class->{$method}($args[0]);
28 | break;
29 | case 2 :
30 | return $class->{$method}($args[0], $args[1]);
31 | break;
32 | case 3 :
33 | return $class->{$method}($args[0], $args[1], $args[2]);
34 | break;
35 | case 4 :
36 | return $class->{$method}($args[0], $args[1], $args[2], $args[3]);
37 | break;
38 | case 5 :
39 | return $class->{$method}($args[0], $args[1], $args[2], $args[3], $args[4]);
40 | break;
41 | default :
42 | return call_user_func_array(array(
43 | $class,
44 | $method
45 | ), $args);
46 | break;
47 | endswitch;
48 |
49 | }//end _invokeMethod
50 |
51 | /**
52 | * Calls a methods that is a static method of a class. This method is generally
53 | * faster than using user_call_func_array.
54 | *
55 | * @param string $class The name of the class to be called
56 | * @param string $method The name of the method in the class to be called
57 | * @param array $args An array of arguements. Arguements have to be embedded in an array to be
58 | * called.
59 | *
60 | * @return mixed $data Data returned by the function called
61 | * @access protected
62 | */
63 | protected static function _invokeStaticMethod($class, $method, $args) {
64 | switch(count($args)) :
65 | case 0 :
66 | return $class::$method();
67 | break;
68 | case 1 :
69 | return $class::$method($args[0]);
70 | break;
71 | case 2 :
72 | return $class::$method($args[0], $args[1]);
73 | break;
74 | case 3 :
75 | return $class::$method($args[0], $args[1], $args[2]);
76 | break;
77 | case 4 :
78 | return $class::$method($args[0], $args[1], $args[2], $args[3]);
79 | break;
80 | case 5 :
81 | return $class::$method($args[0], $args[1], $args[2], $args[3], $args[4]);
82 | break;
83 | default :
84 | return call_user_func_array(array(
85 | $class,
86 | $method
87 | ), $args);
88 | break;
89 | endswitch;
90 |
91 | }//end _invokeMethod
92 |
93 | /**
94 | * Breaks down the data to be logged from an adapter, filter or observer.
95 | *
96 | * @param array $data
97 | *
98 | * @return string $message JSON encode message of information about the data
99 | * @access private
100 | */
101 | private static function _prepareLogData($data) {
102 |
103 | foreach ($data as $key => $value) {
104 | if ($value instanceof Closure) {
105 | $closure = new \ReflectionFunction($value);
106 | $data[$key] = $closure->getFileName();
107 | $data['start_line'] = $closure->getStartLine();
108 | $data['end_line'] = $closure->getEndLine();
109 | } else if (is_object($value)) {
110 | $object = new \ReflectionClass($value);
111 | $data[$key] = $object->getFileName();
112 | $data['start_line'] = $object->getStartLine();
113 | $data['end_line'] = $object->getEndLine();
114 | } else if (!is_string($value)) {
115 | unset($data[$key]);
116 | }
117 |
118 | }
119 |
120 | return json_encode($data);
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/src/design/StaticObserver.php:
--------------------------------------------------------------------------------
1 | 'static',
45 | 'class' => $class,
46 | 'method' => $method,
47 | 'type' => 'class_method'
48 | );
49 |
50 | $options += $default;
51 | self::$_observers[$event][] = $options;
52 | }//end _addObersver
53 |
54 | /**
55 | * Calls any functions that have been added to the observer if the event is present in the
56 | * observers array.
57 | *
58 | * @param string $event The name of the even that occured that will trigger notifies
59 | * @param mixed $args An array of infinite arguements that will passed to each function related to
60 | * the event
61 | *
62 | * @return void
63 | * @access protected
64 | */
65 | protected static function _notify($event) {
66 |
67 | $args = func_get_args();
68 | array_shift($args);
69 |
70 | $passable_args = array();
71 | foreach ($args as $key => &$arg) {
72 | $passable_args[$key] = &$arg;
73 | }
74 |
75 | if (isset(self::$_observers[$event])) {
76 | foreach (self::$_observers[$event] as $options) {
77 |
78 | if (self::$_traceObservers) {
79 | $trace = debug_backtrace();
80 | $options['trace'] = $trace[1]['class'] . '::' . $trace[1]['function'];
81 | self::_logObserver($options);
82 | }
83 |
84 | if ($options['type'] === 'closure')
85 | call_user_func_array($options['method'], $passable_args);
86 | else if ($options['type'] === 'instance')
87 | self::_invokeMethod($options['class'], $options['method'], $passable_args);
88 | else
89 | self::_invokeStaticMethod($options['class'], $options['method'], $passable_args);
90 | }//end for each
91 | }
92 |
93 | }//end _notify
94 |
95 | /**
96 | * Removes all the observers assoicated with an event.
97 | *
98 | * @param string $event The event to remove all the observers from
99 | *
100 | * @return void
101 | * @access public
102 | */
103 | public static function clearObservers($event) {
104 | unset(self::$_observers[$event]);
105 | }
106 |
107 | /**
108 | * Turn on/off the ability to trace an observer.Turning on will log
109 | * an observer using Log when the observer is executed.
110 | *
111 | * @param boolean $trace Default is false. If set to true, will trace observer.
112 | *
113 | * @return void
114 | * @access public
115 | */
116 | public static function setObserverTrace($trace = false) {
117 | self::$_traceObservers = $trace;
118 | }
119 |
120 | /**
121 | * Write out the contents of an observer to a log.
122 | *
123 | * @param array $data The data in the observer
124 | *
125 | * @return void
126 | * @access private
127 | */
128 | protected static function _logObserver($data) {
129 | $message = self::_prepareLogData($data);
130 | Log::writeLog('observer', $message);
131 | }
132 |
133 |
134 |
135 | }
136 |
--------------------------------------------------------------------------------
/src/util/Cli.php:
--------------------------------------------------------------------------------
1 |
13 | * @since August 21, 2009
14 | * @see https://github.com/pwfisher/CommandLine.php
15 | *
16 | * This work is licensed under the Creative Commons Attribution License.
17 | * http://creativecommons.org/licenses/by/3.0/
18 | *
19 | * @package util
20 | */
21 | class Cli {
22 |
23 | use StaticObject;
24 |
25 | /**
26 | * Args parsed from command linke entry
27 | */
28 | public static $args;
29 |
30 | /**
31 | * Parse the command line arguements
32 | *
33 | * @param string $argv Arguements from teh command line
34 | *
35 | * @return array An array of items to output
36 | */
37 | public static function parse($argv = null) {
38 |
39 | if (self::_hasAdapter(get_class(), __FUNCTION__))
40 | return self::_callAdapter(get_class(), __FUNCTION__, $argv);
41 |
42 | $argv = self::_applyFilter(get_class(), __FUNCTION__, $argv, array('event' => 'args'));
43 |
44 | $argv = ($argv) ? : $_SERVER['argv'];
45 |
46 | array_shift($argv);
47 |
48 | $out = array();
49 |
50 | for ($i = 0, $j = count($argv); $i < $j; $i++) {
51 | $arg = $argv[$i];
52 |
53 | // --foo --bar=baz
54 | if (substr($arg, 0, 2) === '--') {
55 | $eqPos = strpos($arg, '=');
56 |
57 | // --foo
58 | if ($eqPos === false) {
59 | $key = substr($arg, 2);
60 |
61 | // --foo value
62 | if ($i + 1 < $j && $argv[$i + 1][0] !== '-') {
63 | $value = $argv[$i + 1];
64 | $i++;
65 | } else {
66 | $value = isset($out[$key]) ? $out[$key] : true;
67 | }
68 | $out[$key] = $value;
69 | }
70 |
71 | // --bar=baz
72 | else {
73 | $key = substr($arg, 2, $eqPos - 2);
74 | $value = substr($arg, $eqPos + 1);
75 | $out[$key] = $value;
76 | }
77 | }
78 |
79 | // -k=value -abc
80 | else if (substr($arg, 0, 1) === '-') {
81 | // -k=value
82 | if (substr($arg, 2, 1) === '=') {
83 | $key = substr($arg, 1, 1);
84 | $value = substr($arg, 3);
85 | $out[$key] = $value;
86 | }
87 | // -abc
88 | else {
89 | $chars = str_split(substr($arg, 1));
90 | foreach ($chars as $char) {
91 | $key = $char;
92 | $value = isset($out[$key]) ? $out[$key] : true;
93 | $out[$key] = $value;
94 | }
95 | // -a value1 -abc value2
96 | if ($i + 1 < $j && $argv[$i + 1][0] !== '-') {
97 | $out[$key] = $argv[$i + 1];
98 | $i++;
99 | }
100 | }
101 | }
102 |
103 | // plain-arg
104 | else {
105 | $value = $arg;
106 | $out[] = $value;
107 | }
108 | }
109 |
110 | self::$args = $out;
111 |
112 | $out = self::_applyFilter(get_class(), __FUNCTION__, $out, array('event' => 'return'));
113 |
114 | return $out;
115 | }
116 |
117 | /**
118 | * GET BOOLEAN
119 | *
120 | * @param string $key
121 | * @param string $default
122 | *
123 | * @todo Revist for figure out what this function was for.
124 | */
125 | public static function getBoolean($key, $default = false) {
126 |
127 | if (self::_hasAdapter(get_class(), __FUNCTION__))
128 | return self::_callAdapter(get_class(), __FUNCTION__, $key, $default);
129 |
130 | if (!isset(self::$args[$key])) {
131 | return $default;
132 | }
133 | $value = self::$args[$key];
134 |
135 | if (is_bool($value)) {
136 | return $value;
137 | }
138 |
139 | if (is_int($value)) {
140 | return (bool)$value;
141 | }
142 |
143 | if (is_string($value)) {
144 | $value = strtolower($value);
145 | $map = array(
146 | 'y' => true,
147 | 'n' => false,
148 | 'yes' => true,
149 | 'no' => false,
150 | 'true' => true,
151 | 'false' => false,
152 | '1' => true,
153 | '0' => false,
154 | 'on' => true,
155 | 'off' => false,
156 | );
157 | if (isset($map[$value])) {
158 | return $map[$value];
159 | }
160 | }
161 |
162 | return $default;
163 | }
164 |
165 | }
166 |
--------------------------------------------------------------------------------
/src/util/Mathematics.php:
--------------------------------------------------------------------------------
1 | 'Cat', 'big' => 'Dog', 1 => 'Ferret', 2 => 'Parrots');
9 |
10 | public function testPrefilledData() {
11 |
12 | $collection = new Collection($this ->_data);
13 |
14 | $this-> assertEquals($this ->_data['big'], $collection -> big);
15 | }
16 |
17 | public function testPrefilledDataCompare() {
18 |
19 | $collection = new Collection($this ->_data);
20 |
21 | $this-> assertEquals($this -> _data, $collection -> getData());
22 | }
23 |
24 | public function testAddingData() {
25 | $collection = new Collection();
26 |
27 | foreach($this -> _data as $key => $value) {
28 | $collection->add($value);
29 | }
30 |
31 | $data = $collection -> getIterator() -> getData();
32 |
33 | $cleaned_data = array_values($this -> _data);
34 |
35 | $this-> assertEquals($data, $cleaned_data);
36 | }
37 |
38 | public function testAddingDataWithName() {
39 | $collection = new Collection();
40 |
41 | foreach($this -> _data as $key => $value) {
42 | $collection->addWithName($key, $value);
43 | }
44 |
45 | $this-> assertEquals($this -> _data, $collection -> getData());
46 | }
47 |
48 | }
49 |
50 |
--------------------------------------------------------------------------------
/tests/design/ObjectTest.php:
--------------------------------------------------------------------------------
1 | 'Dog',
29 | 'meow' => 'Cat',
30 | 'gallup' => 'Horse'
31 | );
32 |
33 | public function testInstanceAddDataWithSetters() {
34 |
35 | $instance = new InstanceTest();
36 |
37 | foreach($this ->_data as $key => $value) {
38 |
39 | $instance->$key=$value;
40 |
41 | }//endforeach
42 |
43 | $this -> assertEquals($this->_data['meow'], $instance-> meow);
44 | }
45 |
46 | public function testInstanceAddDataWithAddWithName() {
47 |
48 | $instance = new InstanceTest();
49 |
50 | foreach($this ->_data as $key => $value) {
51 |
52 | $instance->addToCollectionWithName($key, $value);
53 |
54 | }//endforeach
55 |
56 | $this -> assertEquals($this->_data['gallup'], $instance-> gallup);
57 | }
58 |
59 | public function testInstanceAddDataWithAddWithoutName() {
60 |
61 | $instance = new InstanceTest();
62 |
63 | foreach($this ->_data as $key => $value) {
64 |
65 | $instance->addToCollection($value);
66 |
67 | }//endforeach
68 |
69 | $this -> assertEquals(array_values($this->_data), $instance-> getIterator()->getData());
70 | }
71 |
72 | public function testInstanceWithMethod() {
73 |
74 | $instance = new InstanceTest();
75 |
76 | $instance->addMethod('foo', function($string) {
77 | return 'bar-'.$string;
78 | });
79 |
80 |
81 | $this -> assertEquals('bar-test', $instance->foo('test'));
82 |
83 |
84 | }
85 |
86 | public function testStaticAddDataWithSetters() {
87 |
88 | foreach($this ->_data as $key => $value) {
89 |
90 | StaticTest::set($key,$value);
91 |
92 | }//endforeach
93 |
94 | $this -> assertEquals($this->_data['meow'], StaticTest::get('meow'));
95 | }
96 |
97 | public function testStaticAddDataWithAddWithName() {
98 |
99 | foreach($this ->_data as $key => $value) {
100 |
101 | StaticTest::addToCollectionWithName($key, $value);
102 |
103 | }//endforeach
104 |
105 | $this -> assertEquals($this->_data['gallup'], StaticTest::get('gallup'));
106 | }
107 |
108 | public function testStaticAddDataWithAddWithoutName() {
109 |
110 | StaticTest::resetCollection();
111 |
112 | foreach($this ->_data as $key => $value) {
113 |
114 | StaticTest::addToCollection($value);
115 |
116 | }//endforeach
117 |
118 | $this -> assertEquals(array_values($this->_data), StaticTest::getIterator()->getData());
119 | }
120 |
121 | public function testStaticWithMethod() {
122 |
123 | StaticTest::addMethod('foo', function($string) {
124 | return 'bar-'.$string;
125 | });
126 |
127 |
128 | $this -> assertEquals('bar-test', StaticTest::foo('test'));
129 |
130 |
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/tests/design/ObserverTest.php:
--------------------------------------------------------------------------------
1 | _notify(__FUNCTION__, $this, $string, $unit);
14 |
15 | }
16 | }
17 |
18 | class ObserverTestStatic {
19 |
20 | use StaticObserver;
21 |
22 | public static function observe($string, $unit) {
23 |
24 | self::_notify(__FUNCTION__, null, $string, $unit);
25 |
26 | }
27 | }
28 |
29 | class InstanceListener {
30 |
31 | public function observed($object, $string, $unit) {
32 |
33 | $unit -> assertEquals('Pass Me Along To Instance', $string);
34 |
35 | }
36 |
37 | }
38 |
39 | class StaticListener {
40 |
41 | public static function observed($object, $string, $unit) {
42 |
43 | $unit -> assertEquals('Pass Me Along To Static', $string);
44 |
45 | }
46 | }
47 |
48 | class ObserverTest extends TestCase {
49 |
50 | public function testInstanceWithClosure() {
51 |
52 | $string = 'Pass Me Along';
53 |
54 | $instance = new ObserverTestInstance();
55 |
56 | $instance -> addObserver('observe', 'ObserverTestInstance', function($object, $string, $unit) {
57 |
58 | $unit -> assertEquals('Pass Me Along', $string);
59 |
60 | }, array('type' => 'closure'));
61 |
62 | $instance->observe($string, $this);
63 |
64 | }
65 |
66 | public function testInstanceWithInstance() {
67 |
68 | $string = 'Pass Me Along To Instance';
69 |
70 | $instance = new ObserverTestInstance();
71 |
72 | $listener = new InstanceListener();
73 |
74 | $instance -> addObserver('observe', $listener , 'observed', array('type' => 'instance'));
75 |
76 | $instance->observe($string, $this);
77 |
78 | }
79 |
80 | public function testInstanceWithStatic() {
81 |
82 | $string = 'Pass Me Along To Static';
83 |
84 | $instance = new ObserverTestInstance();
85 |
86 | $instance -> setObserverTrace(true);
87 |
88 | $instance -> addObserver('observe', 'StaticListener' , 'observed', array('type' => 'static'));
89 |
90 | $instance->observe($string, $this);
91 | }
92 |
93 | public function testStaticWithClosure() {
94 |
95 | $string = 'Pass Me Along';
96 |
97 | ObserverTestStatic::addObserver('observe', 'ObserverTestStatic', function($object, $string, $unit) {
98 |
99 | $unit -> assertEquals('Pass Me Along', $string);
100 |
101 | }, array('type' => 'closure'));
102 |
103 | ObserverTestStatic::observe($string, $this);
104 |
105 | }
106 |
107 | public function testStaticWithInstance() {
108 |
109 | ObserverTestStatic::clearObservers('observe');
110 |
111 | $string = 'Pass Me Along To Instance';
112 |
113 | $listener = new InstanceListener();
114 |
115 | ObserverTestStatic::addObserver('observe', $listener , 'observed', array('type' => 'instance'));
116 |
117 | ObserverTestStatic::setObserverTrace(true);
118 |
119 | ObserverTestStatic::observe($string, $this);
120 |
121 | }
122 |
123 | public function testStaticWithStatic() {
124 |
125 | ObserverTestStatic::clearObservers('observe');
126 |
127 | $string = 'Pass Me Along To Static';
128 |
129 | ObserverTestStatic::addObserver('observe', 'StaticListener' , 'observed', array('type' => 'static'));
130 |
131 | ObserverTestStatic::observe($string, $this);
132 | }
133 |
134 | }
135 |
--------------------------------------------------------------------------------
/tests/design/StaticInstanceTest.php:
--------------------------------------------------------------------------------
1 | 'Dog',
14 | 'meow' => 'Cat',
15 | 'gallup' => 'Horse'
16 | );
17 |
18 | public function testInstanceAddDataWithSetters() {
19 |
20 | $instance = new StaticInstanceObject();
21 |
22 | foreach($this ->_data as $key => $value) {
23 |
24 | $instance->$key=$value;
25 |
26 | }//endforeach
27 |
28 | $this -> assertEquals($this->_data['meow'], $instance-> meow);
29 | }
30 |
31 | public function testInstanceAddDataWithAddWithName() {
32 |
33 | $instance = new StaticInstanceObject();
34 |
35 | foreach($this ->_data as $key => $value) {
36 |
37 | $instance->addToCollectionWithName($key, $value);
38 |
39 | }//endforeach
40 |
41 | $this -> assertEquals($this->_data['gallup'], $instance-> gallup);
42 | }
43 |
44 | public function testInstanceAddDataWithAddWithoutName() {
45 |
46 | $instance = new StaticInstanceObject();
47 |
48 | foreach($this ->_data as $key => $value) {
49 |
50 | $instance->addToCollection($value);
51 |
52 | }//endforeach
53 |
54 | $this -> assertEquals(array_values($this->_data), $instance-> getIterator()->getData());
55 | }
56 |
57 | public function testInstanceWithMethod() {
58 |
59 | $instance = new StaticInstanceObject();
60 |
61 | $instance->addMethod('foo', function($string) {
62 | return 'bar-'.$string;
63 | });
64 |
65 |
66 | $this -> assertEquals('bar-test', $instance->foo('test'));
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/tests/media/ImageTests.php:
--------------------------------------------------------------------------------
1 | sys_get_temp_dir ()
14 | ));
15 | }
16 |
17 | protected function tearDown(): void {
18 | PVCache::deleteCache($this->cacheKey);
19 | }
20 |
21 | public function testCacheNotExist() {
22 | $result = PVCache::hasExpired($this->cacheKey);
23 | $this->assertTrue($result);
24 | }
25 |
26 | public function testCacheNotReadable() {
27 | $result = PVCache::readCache($this->cacheKey);
28 | $this->assertEquals($result, '');
29 | }
30 |
31 | public function testCacheWrite() {
32 | PVCache::writeCache($this->cacheKey, $this->cacheContent);
33 | $result = PVCache::readCache($this->cacheKey);
34 | $this->assertEquals($result,$this->cacheContent);
35 | }
36 |
37 | public function testCacheDelete() {
38 | PVCache::deleteCache($this->cacheKey);
39 | $result = PVCache::readCache($this->cacheKey);
40 | $this->assertEquals($result, '');
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/tests/network/CurlTest.php:
--------------------------------------------------------------------------------
1 | send('get');
14 | $data = json_decode($curl->getResponse(), true);
15 |
16 | $this->assertTrue(is_array($data));
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/tests/network/RequestTests.php:
--------------------------------------------------------------------------------
1 | assertEquals('http://www.example.com?item=1', $url);
24 | }
25 |
26 | public function testGetCurrentUrlNotPort80() {
27 |
28 | $_SERVER['SERVER_PORT'] = 8080;
29 |
30 | $_SERVER['HTTP_HOST'] = 'www.example.com';
31 |
32 | $_SERVER['REQUEST_URI'] = '?item=1';
33 |
34 | $url = Router::getCurrentUrl();
35 |
36 | $this->assertEquals('http://www.example.com:8080?item=1', $url);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/tests/network/SocketTest.php:
--------------------------------------------------------------------------------
1 | assertTrue(true);
14 | /*
15 | $socket = new Socket('ws://demos.kaazing.com/echo-auth', 0);
16 | $response = $socket->send('Rock it with HTML5 WebSocket');
17 |
18 | $server = new Socket('localhost', 8000,array('bind' => true, 'listen' => true));
19 | $server->startServer('',function($message){
20 | echo $message;
21 | }, 'closure');
22 | echo 'Ok';
23 |
24 |
25 | print_r($response);
26 |
27 | exit();
28 | exit();*/
29 |
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/tests/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ./
5 |
6 |
--------------------------------------------------------------------------------
/tests/system/ConfigurationTest.php:
--------------------------------------------------------------------------------
1 | assertEquals($value, Configuration::getConfiguration($key));
22 | }
23 |
24 | public function testAddRetrieveArrayConfiguration() {
25 |
26 | $key = 'config2';
27 |
28 | $value = array(
29 | 'item1' => 'Apples',
30 | 'item2' => 'Bears',
31 | );
32 |
33 | Configuration::addConfiguration($key, $value);
34 |
35 | $this-> assertEquals('Bears', Configuration::getConfiguration($key) -> item2);
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/tests/system/LibrariesTest.php:
--------------------------------------------------------------------------------
1 | 'https://code.jquery.com/jquery-3.3.1.min.js',
17 | 'https://unpkg.com/tooltip.js' => 'https://unpkg.com/tooltip.js',
18 | );
19 |
20 | foreach($scripts as $script) {
21 | Libraries::enqueueJavascript($script);
22 | }//endforeach
23 |
24 | $queued_scripts = Libraries::getJavascriptQueue();
25 |
26 | $this->assertEquals($scripts, $queued_scripts);
27 | }
28 |
29 | public function testCss() {
30 |
31 | $scripts = array(
32 | 'https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css' => 'https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css',
33 | 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css' => 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css',
34 | );
35 |
36 | foreach($scripts as $script) {
37 | Libraries::enqueueCss($script);
38 | }//endforeach
39 |
40 | $queued_scripts = Libraries::getCssQueue();
41 |
42 | $this->assertEquals($scripts, $queued_scripts);
43 | }
44 |
45 | public function testLibraries() {
46 |
47 | $libraries = array(
48 | 'library1' => array(),
49 | );
50 |
51 | foreach($libraries as $key => $options) {
52 | Libraries::addLibrary($key, $options);
53 | }
54 |
55 | $this->assertTrue(true);
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/tests/system/SecurityTest.php:
--------------------------------------------------------------------------------
1 | assertEquals($string, Security::decrypt($result));
20 |
21 | }
22 |
23 | public function testPasswordHash() {
24 |
25 | $result = Security::hash('abc123');
26 |
27 | $this -> assertTrue(true);
28 | }
29 |
30 | public function testToken() {
31 |
32 | $length = 10;
33 |
34 | $token = Security::generateToken($length);
35 |
36 | $this -> assertEquals(strlen($token), $length*2);
37 | }
38 |
39 | public function testHMacSignature() {
40 |
41 | $public_key = 'public_key';
42 |
43 | $private_key = 'private_key';
44 |
45 | $signature_1 = Security::encodeHmacSignature($public_key, $private_key);
46 |
47 | $signature_2 = Security::encodeHmacSignature($public_key, $private_key);
48 |
49 | $this->assertTrue(hash_equals($signature_1, $signature_2));
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/tests/system/SessionTest.php:
--------------------------------------------------------------------------------
1 | assertTrue(true);
24 |
25 | }
26 |
27 | public function testSession() {
28 | $cookie_name = 'test_cookie';
29 | $cookie_value = 'test_cookie_value';
30 |
31 | Session::writeSession($cookie_name, $cookie_value);
32 |
33 | $this -> assertEquals($cookie_value, Session::readSession($cookie_name));
34 |
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/tests/template/HtmlTest.php:
--------------------------------------------------------------------------------
1 | assertEquals('', $result);
15 | }
16 |
17 | public function testStandardAttributes() {
18 |
19 | $options = array(
20 | 'class' => 'bootstrap',
21 | 'id' => 'div1',
22 | 'style' => 'width:300',
23 | 'xml:lang' => 'html5',
24 | 'spellcheck' => 'false',
25 | 'title' => 'Title'
26 | );
27 |
28 | $result = Html::getStandardAttributes($options);
29 |
30 | $this -> assertEquals('class="bootstrap" id="div1" style="width:300" xml:lang="html5" spellcheck="false" title="Title"', trim($result));
31 | }
32 |
33 | public function testImageFullUrl() {
34 | $image_url = 'https://avatars2.githubusercontent.com/u/1185218?s=200&v=4';
35 |
36 | $result = Html::image($image_url);
37 |
38 | $this -> assertEquals('
', trim($result));
39 | }
40 |
41 | public function testImageLocal() {
42 | $image_url = '/img/test.jpeg';
43 |
44 | $result = Html::image($image_url);
45 |
46 | $this -> assertEquals('
', trim($result));
47 | }
48 |
49 | public function testTimeTag() {
50 | $time = '10:00';
51 |
52 | $result = Html::time($time);
53 |
54 | $this -> assertEquals('', Tools::removeWhiteSpace($result));
55 | }
56 |
57 | public function testIframe() {
58 | $src = 'https://github.com/ProdigyView-Toolkit/prodigyview';
59 | $data = 'HeloWorld';
60 |
61 | $result = Html::iframe($src, $data);
62 |
63 | $this -> assertEquals('', $result);
64 | }
65 |
66 |
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/tests/template/TemplateTest.php:
--------------------------------------------------------------------------------
1 | 'success', 'message' => 'First message'),
10 | array('type' => 'success', 'message' => 'Second message'),
11 | array('type' => 'danger', 'message' => 'Third message'),
12 | array('type' => 'danger', 'message' => 'Fourth message'),
13 | );
14 |
15 | public function testSiteTitle() {
16 |
17 | $string = 'Site Title';
18 |
19 | Template::setSiteTitle($string);
20 |
21 | $this -> assertEquals($string, Template::getSiteTitle());
22 | }
23 |
24 | public function testSiteKeywords() {
25 |
26 | $string = 'Site Keywords';
27 |
28 | Template::setSiteKeywords($string);
29 |
30 | $this -> assertEquals($string, Template::getSiteKeywords());
31 | }
32 |
33 | public function testSiteMetaDescription() {
34 |
35 | $string = 'Site Meta Description';
36 |
37 | Template::setSiteMetaDescription($string);
38 |
39 | $this -> assertEquals($string, Template::getSiteMetaDescription());
40 | }
41 |
42 | public function testSiteMetaTags() {
43 |
44 | $string = 'Site Meta Tags';
45 |
46 | Template::setSiteMetaTags($string);
47 |
48 | $this -> assertEquals($string, Template::getSiteMetaTags());
49 | }
50 |
51 | public function testFlashMessages() {
52 |
53 | $successes = array();
54 |
55 | foreach($this -> _flashMessages as $message) {
56 | Template::addFlashMessage($message['type'], $message['message']);
57 |
58 | if($message['type'] == 'success') {
59 | $successes[] = $message['message'];
60 | }
61 |
62 | }
63 |
64 | $messages = Template::getFlashMessages('success');
65 |
66 | $this->assertEquals($messages, $successes);
67 | }
68 |
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/tests/util/CacheTest.php:
--------------------------------------------------------------------------------
1 | sys_get_temp_dir ()
15 | ));
16 | }
17 |
18 | protected function tearDown(): void {
19 | Cache::deleteCache($this->cacheKey);
20 | }
21 |
22 | public function testCacheNotExist() {
23 | $result = Cache::hasExpired($this->cacheKey);
24 |
25 | $this->assertTrue($result);
26 | }
27 |
28 | public function testCacheNotReadable() {
29 | $result = Cache::readCache($this->cacheKey);
30 |
31 | $this->assertEquals($result, '');
32 | }
33 |
34 | public function testCacheWrite() {
35 | Cache::writeCache($this->cacheKey, $this->cacheContent);
36 |
37 | $result = Cache::readCache($this->cacheKey);
38 | $this->assertEquals($result,$this->cacheContent);
39 | }
40 |
41 | public function testCacheDelete() {
42 | Cache::deleteCache($this->cacheKey);
43 |
44 | $result = Cache::readCache($this->cacheKey);
45 | $this->assertEquals($result, '');
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/tests/util/CliTest.php:
--------------------------------------------------------------------------------
1 | 'file.php --file=test.text --path=none',
15 | 'output' => array(
16 | 'file' => 'test.text',
17 | 'path' => 'none'
18 | ),
19 | );
20 |
21 | private function convertStringToArgv($string) {
22 | preg_match_all('/(?<=^|\s)([\'"]?)(.+?)(?convertStringToArgv($this->_command_line_1['input']));
29 |
30 | $this->assertTrue($this -> arrays_are_similar($output, $this->_command_line_1['output']));
31 | }
32 |
33 | /**
34 | * Determine if two associative arrays are similar
35 | *
36 | * Both arrays must have the same indexes with identical values
37 | * without respect to key ordering
38 | *
39 | * @param array $a
40 | * @param array $b
41 | * @return bool
42 | * @author https://stackoverflow.com/questions/3838288/phpunit-assert-two-arrays-are-equal-but-order-of-elements-not-important
43 | */
44 | private function arrays_are_similar($a, $b) {
45 | // if the indexes don't match, return immediately
46 | if (count(array_diff_assoc($a, $b))) {
47 | return false;
48 | }
49 | // we know that the indexes, but maybe not values, match.
50 | // compare the values between the two arrays
51 | foreach ($a as $k => $v) {
52 | if ($v !== $b[$k]) {
53 | return false;
54 | }
55 | }
56 | // we have identical indexes, and no unequal values
57 | return true;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/tests/util/ConversionTest.php:
--------------------------------------------------------------------------------
1 | SLOT 1SLOT 2child1Chid 2';
20 |
21 | protected function setUp(): void {
22 | $this -> _testArray = array('slot_1' => 'SLOT 1', 123 => 'SLOT 2', 'sub' => array('child1', 'one' => 'Chid 2'));
23 |
24 | $this -> _testObject = (object) array('slot_1' => 'SLOT 1', 123 => 'SLOT 2', 'sub' => (object) array('child1', 'one' => 'Chid 2'));
25 | }
26 |
27 | public function testObjectToArray() {
28 |
29 | $output = Conversions::objectToArray($this -> _testObject);
30 |
31 | $this->assertEquals($output, $this -> _testArray);
32 |
33 | $this->assertCount(3, $output);
34 | }
35 |
36 | public function testArrayToObject() {
37 |
38 | $output = Conversions::arrayToObject($this -> _testArray);
39 |
40 | $this->assertEquals($output, $this -> _testObject);
41 |
42 | $this->assertCount(3, (array)$output);
43 | }
44 |
45 | public function testArrayToXML() {
46 |
47 | $output = Conversions::arrayToXml($this -> _testArray);
48 |
49 | $this->assertEquals($output, $this -> _testXML);
50 |
51 | }
52 |
53 | public function testXmlToArray() {
54 |
55 | $output = Conversions::xmlToArray($this -> _testXML);
56 |
57 | Tools::replaceKeyNamesInArray($output, 'item_', '');
58 |
59 | $this->assertEquals($output, $this -> _testArray);
60 | }
61 |
62 | public function testEncodingSameArray() {
63 |
64 | $output = $this -> _testArray;
65 | Conversions::encodeRecursive($output);
66 |
67 | $this->assertEquals($output, $this -> _testArray);
68 | }
69 |
70 | public function testEncodingDifferentArray() {
71 |
72 | $output = $this -> _testArray;
73 | Conversions::encodeRecursive($output,'EUC-JP');
74 |
75 | $this->assertEquals($output, $this -> _testArray);
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/tests/util/FileManagerTest.php:
--------------------------------------------------------------------------------
1 | _test_dir)) {
25 | mkdir($this -> _test_dir);
26 | }
27 | }
28 |
29 | protected function tearDown(): void {
30 | FileManager::deleteDirectory($this -> _test_dir);
31 | }
32 |
33 | public function testFileSizePerl() {
34 |
35 | $file_name = $this -> _test_dir.'perl_file_test.txt';
36 | $size = 500;
37 |
38 | if(!file_exists($file_name)) {
39 | $fp = fopen($file_name, 'w');
40 | fseek($fp, $size-1,SEEK_CUR);
41 | fwrite($fp,'a');
42 | fclose($fp);
43 | }
44 |
45 | $perl_size = FileManager::getFileSize_PERL($file_name);
46 |
47 | $this->assertEquals($perl_size, $size);
48 | }
49 |
50 | public function testFileCount() {
51 | $folder = $this -> _test_dir.'file_count/';
52 |
53 | if(!file_exists($folder)) {
54 | mkdir($folder);
55 | }
56 |
57 | foreach($this -> _random_files as $file) {
58 | $tmp_file = $folder.$file;
59 |
60 | if(!file_exists($tmp_file)) {
61 | $fp = fopen($tmp_file, "w");
62 | fclose($fp);
63 |
64 | }
65 | }//endforeach
66 |
67 | $found_files = FileManager::getFilesInDirectory($folder);
68 |
69 |
70 | $this->assertEquals(count($found_files), count($this -> _random_files));
71 | }
72 |
73 | public function testWriteFile() {
74 | $stored_file = $this -> _test_dir.'stored_file.txt';
75 |
76 | FileManager::writeFile($stored_file, 'PHP Unit Tests');
77 |
78 | $this->assertTrue(file_exists($stored_file));
79 | }
80 |
81 | public function testWillNotWriteOverExisting() {
82 |
83 | $stored_file = $this -> _test_dir.'stored_file.txt';
84 |
85 | FileManager::writeFile($stored_file, 'PHP Unit Tests');
86 |
87 | $result = FileManager::writeNewFile($stored_file, 'PHP Unit Tests');
88 |
89 | $this->assertFalse($result);
90 |
91 | }
92 |
93 | public function testCreateRandomNewFile() {
94 |
95 | $stored_file = $this -> _test_dir. Tools::generateRandomString(30) .'.txt';
96 |
97 | $result = FileManager::writeNewFile($stored_file, 'PHP Unit Tests');
98 |
99 | $this->assertTrue(file_exists($stored_file));
100 |
101 | }
102 |
103 | public function testFileContent() {
104 |
105 | $stored_file = $this -> _test_dir. 'test_contents.txt';
106 |
107 | $content = 'ProdigyView is awesome!';
108 |
109 | FileManager::writeNewFile($stored_file, $content);
110 |
111 | $read_contents = FileManager::readFile($stored_file);
112 |
113 | $this->assertEquals($read_contents, $content);
114 |
115 | }
116 |
117 |
118 | }
119 |
--------------------------------------------------------------------------------
/tests/util/LogTest.php:
--------------------------------------------------------------------------------
1 | _test_dir)) {
13 | mkdir($this -> _test_dir);
14 | }
15 |
16 | Log::init(array('directory' => $this -> _test_dir));
17 | }
18 |
19 | protected function tearDown(): void {
20 | FileManager::deleteDirectory($this -> _test_dir);
21 | }
22 |
23 | public function testWriteLog() {
24 | $result = Log::writeLog('Low', 'Testing Low Log Message');
25 |
26 | $this -> assertTrue($result);
27 | }
28 |
29 | public function testReadLog() {
30 | $priority = 'High';
31 | $message = 'Testing High Log Message';
32 |
33 | Log::writeLog($priority, $message);
34 |
35 | $log = Log::readLog($priority);
36 |
37 | $this -> assertTrue((strpos($log, $priority) !== false && strpos($log, $message) !== false));
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/tests/util/ToolsTest.php:
--------------------------------------------------------------------------------
1 | array(
11 | 'food' => array(
12 | 'eggs',
13 | 'bacon'
14 | ),
15 | 'drinks' => array(
16 | 'coffee',
17 | 'tea'
18 | )
19 | ),
20 | 'dinner' => array(
21 | 'food' => array(
22 | 'steak',
23 | 'bread'
24 | ),
25 | 'drinks' => array(
26 | 'wine',
27 | 'juice'
28 | )
29 | ),
30 | );
31 |
32 | public function testRandomString() {
33 |
34 | $length = 20;
35 |
36 | $result = Tools::generateRandomString($length);
37 |
38 | $this->assertEquals(strlen($result), $length);
39 | }
40 |
41 | public function testTruncateText() {
42 | $length = 15;
43 |
44 | $text = 'Everything should be like a Tweet. No one likes long paragraphs';
45 |
46 | $text = Tools::truncateText($text, $length, $trailing = '---');
47 |
48 | $this->assertEquals('Everything shou---', $text);
49 | }
50 |
51 | public function testTruncateTextWithAllHtml() {
52 | $length = 15;
53 |
54 | $text = 'Everything should be like a Tweet. No one likes long paragraphs
';
55 |
56 | $text = Tools::truncateText($text, $length, $trailing = '-.-', false);
57 |
58 | $this->assertEquals('
Ever-.-', $text);
59 | }
60 |
61 | public function testTruncateTextWithLimitedHtml() {
62 | $length = 15;
63 |
64 | $text = 'Everything should be like a Tweet. No one likes long paragraphs
';
65 |
66 | $text = Tools::truncateText($text, $length, $trailing = '...', true, '
');
67 |
68 | $this->assertEquals('
Everything s...', $text);
69 | }
70 |
71 | public function testArrayRecursiveFound() {
72 |
73 | $result = Tools::arraySearchRecursive('wine',$this -> _largeArray);
74 |
75 | $this -> assertNotEmpty($result);
76 | }
77 |
78 | public function testArrayRecursiveNotFound() {
79 |
80 | $result = Tools::arraySearchRecursive('chicken',$this -> _largeArray);
81 |
82 | $this -> assertFalse($result);
83 | }
84 |
85 | public function testRemoveWhiteSpace() {
86 | $string = "
Hello \t\n\r\x0B World
";
87 |
88 | $result = Tools::removeWhiteSpace($string);
89 |
90 | $this -> assertEquals("HelloWorld
", $result);
91 | }
92 |
93 | public function testRemoveNonAscii() {
94 | $string = "Hello’\0World
";
95 |
96 | $result = Tools::removeNonAsciiCharacters($string);
97 |
98 | $this -> assertEquals("HelloWorld
", $result);
99 | }
100 |
101 | public function testArrayKeyReplace() {
102 |
103 | $data = $this -> _largeArray;
104 |
105 | Tools::replaceKeyNamesInArray($data, 'breakfast', 'desayuna');
106 | Tools::replaceKeyNamesInArray($data, 'drinks', 'bebidas');
107 |
108 | $this->assertEquals($this -> _largeArray['breakfast']['drinks'], $data['desayuna']['bebidas']);
109 | }
110 |
111 | }
112 |
--------------------------------------------------------------------------------