1<?php 2 3/* 4 Phoronix Test Suite 5 URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/ 6 Copyright (C) 2009 - 2018, Phoronix Media 7 Copyright (C) 2009 - 2018, Michael Larabel 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 3 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program. If not, see <http://www.gnu.org/licenses/>. 21*/ 22 23class pts_documentation 24{ 25 public static function client_commands_aliases() 26 { 27 $command_aliases = array(); 28 foreach(pts_file_io::glob(PTS_COMMAND_PATH . '*.php') as $option_php_file) 29 { 30 $option_php = basename($option_php_file, '.php'); 31 32 include_once($option_php_file); 33 if(method_exists($option_php, 'command_aliases')) 34 { 35 $this_aliases = call_user_func(array($option_php, 'command_aliases')); 36 37 if(is_array($this_aliases)) 38 { 39 foreach($this_aliases as $alias) 40 { 41 $command_aliases[$alias] = $option_php; 42 } 43 } 44 } 45 } 46 47 return $command_aliases; 48 } 49 public static function client_commands_array() 50 { 51 $options = array('System' => array(), 'Test Installation' => array(), 'Testing' => array(), 'Batch Testing' => array(), 'OpenBenchmarking.org' => array(), 'Information' => array(), 'Asset Creation' => array(), 'Result Management' => array(), 'Result Analytics' => array(), 'Other' => array()); 52 53 foreach(pts_file_io::glob(PTS_COMMAND_PATH . '*.php') as $option_php_file) 54 { 55 $option_php = basename($option_php_file, '.php'); 56 $name = str_replace('_', '-', $option_php); 57 58 if(!in_array(pts_strings::first_in_string($name, '-'), array('dump', 'task'))) 59 { 60 include_once($option_php_file); 61 62 $reflect = new ReflectionClass($option_php); 63 $constants = $reflect->getConstants(); 64 65 $doc_description = isset($constants['doc_description']) ? constant($option_php . '::doc_description') : 'No summary is available.'; 66 $doc_section = isset($constants['doc_section']) ? constant($option_php . '::doc_section') : 'Other'; 67 $name = isset($constants['doc_use_alias']) ? constant($option_php . '::doc_use_alias') : $name; 68 $skip = isset($constants['doc_skip']) ? constant($option_php . '::doc_skip') : false; 69 $doc_args = array(); 70 71 if($skip) 72 { 73 continue; 74 } 75 76 if(method_exists($option_php, 'argument_checks')) 77 { 78 $doc_args = call_user_func(array($option_php, 'argument_checks')); 79 } 80 81 if(!empty($doc_section) && !isset($options[$doc_section])) 82 { 83 $options[$doc_section] = array(); 84 } 85 86 $options[$doc_section][] = array($name, $doc_args, $doc_description); 87 } 88 } 89 90 return $options; 91 } 92 public static function client_commands_possible_values() 93 { 94 static $commands_possible_values = null; 95 96 if(empty($commands_possible_values)) 97 { 98 foreach(pts_file_io::glob(PTS_COMMAND_PATH . '*.php') as $option_php_file) 99 { 100 $option_php = basename($option_php_file, '.php'); 101 $name = str_replace('_', '-', $option_php); 102 103 if(!in_array(pts_strings::first_in_string($name, '-'), array('task'))) 104 { 105 include_once($option_php_file); 106 107 $reflect = new ReflectionClass($option_php); 108 $constants = $reflect->getConstants(); 109 110 $args = null; 111 if(method_exists($option_php, 'argument_checks')) 112 { 113 $args = call_user_func(array($option_php, 'argument_checks')); 114 } 115 $command_aliases = array(); 116 if(method_exists($option_php, 'command_aliases')) 117 { 118 $command_aliases = call_user_func(array($option_php, 'command_aliases')); 119 } 120 $command_aliases[] = $name; 121 if(isset($args[0]) && $args[0] instanceof pts_argument_check) 122 { 123 $arg_possible_values = $args[0]->possible_values(); 124 foreach($command_aliases as $alias) 125 { 126 $commands_possible_values[$alias] = $arg_possible_values; 127 } 128 } 129 } 130 } 131 } 132 133 return $commands_possible_values; 134 } 135 public static function basic_description() 136 { 137 return 'The **Phoronix Test Suite** is the most comprehensive testing and benchmarking platform available for Linux, Solaris, macOS, Windows, and BSD operating systems. The Phoronix Test Suite allows for carrying out tests in a fully automated manner from test installation to execution and reporting. All tests are meant to be easily reproducible, easy-to-use, and support fully automated execution. The Phoronix Test Suite is open-source under the GNU GPLv3 license and is developed by Phoronix Media in cooperation with partners.'; 138 } 139} 140 141?> 142