当前位置: 首页>>代码示例>>PHP>>正文


PHP pts_arrays::to_array方法代码示例

本文整理汇总了PHP中pts_arrays::to_array方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_arrays::to_array方法的具体用法?PHP pts_arrays::to_array怎么用?PHP pts_arrays::to_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pts_arrays的用法示例。


在下文中一共展示了pts_arrays::to_array方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: what_provides

 public static function what_provides($files_needed)
 {
     $packages_needed = array();
     foreach (pts_arrays::to_array($files_needed) as $file) {
         if (pts_client::executable_in_path('apt-file')) {
             if (!defined('APT_FILE_UPDATED')) {
                 shell_exec('apt-file update 2>&1');
                 define('APT_FILE_UPDATED', 1);
             }
             // Try appending common paths
             if (strpos($file, '.h') !== false) {
                 $apt_provides = self::run_apt_file_provides('/usr/include/' . $file);
                 if ($apt_provides != null) {
                     $packages_needed[$file] = $apt_provides;
                 }
             } else {
                 if (strpos($file, '.so') !== false) {
                     $apt_provides = self::run_apt_file_provides('/usr/lib/' . $file);
                     if ($apt_provides != null) {
                         $packages_needed[$file] = $apt_provides;
                     }
                 } else {
                     foreach (array('/usr/bin/', '/bin/', '/usr/sbin') as $possible_path) {
                         $apt_provides = self::run_apt_file_provides($possible_path . $file);
                         if ($apt_provides != null) {
                             $packages_needed[$file] = $apt_provides;
                             break;
                         }
                     }
                 }
             }
         }
     }
     return $packages_needed;
 }
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:35,代码来源:ubuntu_dependency_handler.php

示例2: read_hal_property

 public static function read_hal_property($udi, $key)
 {
     $value = false;
     if (pts_client::executable_in_path('hal-get-property')) {
         foreach (pts_arrays::to_array($udi) as $udi_check) {
             $value = trim(shell_exec('hal-get-property --udi ' . $udi_check . ' --key ' . $key . ' 2> /dev/null'));
             if ($value != false) {
                 break;
             }
         }
     }
     return $value;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:13,代码来源:phodevi_solaris_parser.php

示例3: read_sysctl

 public static function read_sysctl($desc)
 {
     // Read sysctl, used by *BSDs
     $info = false;
     if (pts_client::executable_in_path('sysctl')) {
         $desc = pts_arrays::to_array($desc);
         for ($i = 0; $i < count($desc) && empty($info); $i++) {
             $output = shell_exec('sysctl ' . $desc[$i] . ' 2>&1');
             if ((($point = strpos($output, ':')) > 0 || ($point = strpos($output, '=')) > 0) && strpos($output, 'unknown oid') === false && strpos($output, 'is invalid') === false && strpos($output, 'not available') === false) {
                 $info = trim(substr($output, $point + 1));
             }
         }
     }
     return $info;
 }
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:15,代码来源:phodevi_bsd_parser.php

示例4: run

 public static function run($r)
 {
     pts_client::$display->generic_heading('System Information');
     echo 'Hardware:' . PHP_EOL . phodevi::system_hardware(true) . PHP_EOL . PHP_EOL;
     echo 'Software:' . PHP_EOL . phodevi::system_software(true) . PHP_EOL . PHP_EOL;
     //
     // Processor Information
     //
     $cpu_flags = phodevi_cpu::get_cpu_flags();
     echo PHP_EOL . 'PROCESSOR:' . PHP_EOL . PHP_EOL;
     echo 'Core Count: ' . phodevi_cpu::cpuinfo_core_count() . PHP_EOL;
     echo 'Thread Count: ' . phodevi_cpu::cpuinfo_thread_count() . PHP_EOL;
     echo 'Cache Size: ' . phodevi_cpu::cpuinfo_cache_size() . ' KB' . PHP_EOL;
     echo 'Instruction Set Extensions: ' . phodevi_cpu::instruction_set_extensions() . PHP_EOL;
     echo 'AES Encryption: ' . ($cpu_flags & phodevi_cpu::get_cpu_feature_constant('aes') ? 'YES' : 'NO') . PHP_EOL;
     echo 'Energy Performance Bias: ' . ($cpu_flags & phodevi_cpu::get_cpu_feature_constant('epb') ? 'YES' : 'NO') . PHP_EOL;
     echo 'Virtualization: ' . (phodevi_cpu::virtualization_technology() ? phodevi_cpu::virtualization_technology() : 'NO') . PHP_EOL;
     // Other info
     foreach (pts_arrays::to_array(pts_test_run_manager::pull_test_notes(true)) as $test_note_head => $test_note) {
         echo ucwords(str_replace('-', ' ', $test_note_head)) . ': ' . $test_note . PHP_EOL;
     }
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:22,代码来源:detailed_system_info.php

示例5: what_provides

 public static function what_provides($files_needed)
 {
     $packages_needed = array();
     foreach (pts_arrays::to_array($files_needed) as $file) {
         if (pts_client::executable_in_path('dnf')) {
             $dnf_provides = self::run_dnf_provides($file);
             if ($dnf_provides != null) {
                 $packages_needed[$file] = $dnf_provides;
             } else {
                 // Try appending common paths
                 if (strpos($file, '.h') !== false) {
                     $dnf_provides = self::run_dnf_provides('/usr/include/' . $file);
                     if ($dnf_provides != null) {
                         $packages_needed[$file] = $dnf_provides;
                     }
                 } else {
                     if (strpos($file, '.so') !== false) {
                         $dnf_provides = self::run_dnf_provides('/usr/lib/' . $file);
                         if ($dnf_provides != null) {
                             $packages_needed[$file] = $dnf_provides;
                         }
                     } else {
                         foreach (array('/usr/bin/', '/bin/', '/usr/sbin') as $possible_path) {
                             $dnf_provides = self::run_dnf_provides($possible_path . $file);
                             if ($dnf_provides != null) {
                                 $packages_needed[$file] = $dnf_provides;
                                 break;
                             }
                         }
                     }
                 }
             }
         }
     }
     return $packages_needed;
 }
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:36,代码来源:fedora_dependency_handler.php

示例6: read_sensors

 public static function read_sensors($attributes)
 {
     // Read LM_Sensors
     $value = false;
     if (isset(phodevi::$vfs->sensors)) {
         $sensors = phodevi::$vfs->sensors;
         $sensors_lines = explode("\n", $sensors);
         $attributes = pts_arrays::to_array($attributes);
         for ($j = 0; $j < count($attributes) && empty($value); $j++) {
             $attribute = $attributes[$j];
             for ($i = 0; $i < count($sensors_lines) && $value == false; $i++) {
                 $line = pts_strings::trim_explode(': ', $sensors_lines[$i]);
                 if (!isset($line[0])) {
                     continue;
                 }
                 $this_attribute = $line[0];
                 if ($this_attribute == $attribute) {
                     $this_remainder = trim(str_replace(array('+', '°'), ' ', $line[1]));
                     $this_value = substr($this_remainder, 0, strpos($this_remainder, ' '));
                     if (is_numeric($this_value) && $this_value > 0) {
                         $value = $this_value;
                     }
                 }
             }
         }
     }
     return $value;
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:28,代码来源:phodevi_linux_parser.php

示例7: get_result_objects

 public function get_result_objects($select_indexes = -1)
 {
     if ($this->result_objects == null) {
         $this->result_objects = array();
         foreach ($this->xml->Result as $result) {
             array_push($this->result_objects, $this->get_result_object($result));
         }
     }
     if ($select_indexes != -1 && $select_indexes !== null) {
         $objects = array();
         if ($select_indexes == 'ONLY_CHANGED_RESULTS') {
             foreach ($this->result_objects as &$result) {
                 // Only show results where the variation was greater than or equal to 1%
                 if (abs($result->largest_result_variation(0.01)) >= 0.01) {
                     array_push($objects, $result);
                 }
             }
         } else {
             foreach (pts_arrays::to_array($select_indexes) as $index) {
                 if (isset($this->result_objects[$index])) {
                     array_push($objects, $this->result_objects[$index]);
                 }
             }
         }
         return $objects;
     }
     return $this->result_objects;
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:28,代码来源:pts_result_file.php

示例8: html_embed_code

 public static function html_embed_code($file_name, $file_type = 'SVG', $attributes = null, $is_xsl = false)
 {
     $attributes = pts_arrays::to_array($attributes);
     $file_name = str_replace('BILDE_EXTENSION', strtolower($file_type), $file_name);
     switch ($file_type) {
         case 'SVG':
             $attributes['data'] = $file_name;
             if ($is_xsl) {
                 $html = '<object type="image/svg+xml">';
                 foreach ($attributes as $option => $value) {
                     $html .= '<xsl:attribute name="' . $option . '">' . $value . '</xsl:attribute>';
                 }
                 $html .= '</object>';
             } else {
                 $html = '<object type="image/svg+xml"';
                 foreach ($attributes as $option => $value) {
                     $html .= $option . '="' . $value . '" ';
                 }
                 $html .= '/>';
             }
             break;
         default:
             $attributes['src'] = $file_name;
             if ($is_xsl) {
                 $html = '<img>';
                 foreach ($attributes as $option => $value) {
                     $html .= '<xsl:attribute name="' . $option . '">' . $value . '</xsl:attribute>';
                 }
                 $html .= '</img>';
             } else {
                 $html = '<img ';
                 foreach ($attributes as $option => $value) {
                     $html .= $option . '="' . $value . '" ';
                 }
                 $html .= '/>';
             }
             break;
     }
     return $html;
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:40,代码来源:pts_svg_dom.php

示例9: process_running_string

 public static function process_running_string($process_arr)
 {
     // Format a nice string that shows processes running
     $p = array();
     $p_string = null;
     $process_arr = pts_arrays::to_array($process_arr);
     foreach ($process_arr as $p_name => $p_processes) {
         foreach ($p_processes as $process) {
             if (pts_client::is_process_running($process)) {
                 $p[] = $p_name;
             }
         }
     }
     $p = array_keys(array_flip($p));
     if (($p_count = count($p)) > 0) {
         for ($i = 0; $i < $p_count; $i++) {
             $p_string .= $p[$i];
             if ($i != $p_count - 1 && $p_count > 2) {
                 $p_string .= ',';
             }
             $p_string .= ' ';
             if ($i == $p_count - 2) {
                 $p_string .= 'and ';
             }
         }
         $p_string .= $p_count == 1 ? 'was' : 'were';
         $p_string .= ' running on this system';
     }
     return $p_string;
 }
开发者ID:pacificIT,项目名称:phoronix-test-suite,代码行数:30,代码来源:pts_test_notes_manager.php

示例10: remove_run

 public function remove_run($remove)
 {
     $remove = pts_arrays::to_array($remove);
     foreach ($this->systems as $i => &$s) {
         if (in_array($s->get_identifier(), $remove)) {
             unset($this->systems[$i]);
         }
     }
     foreach ($this->result_objects as &$result) {
         $result->test_result_buffer->remove($remove);
     }
 }
开发者ID:jsavikko,项目名称:phoronix-test-suite,代码行数:12,代码来源:pts_result_file.php

示例11: monitor_layout

 public static function monitor_layout()
 {
     // Determine layout for multiple monitors
     $monitor_layout = array('CENTER');
     if (phodevi::read_property('monitor', 'count') > 1) {
         $xdpy_monitors = phodevi_parser::read_xdpy_monitor_info();
         $hit_0_0 = false;
         for ($i = 0; $i < count($xdpy_monitors); $i++) {
             $monitor_position = explode('@', $xdpy_monitors[$i]);
             $monitor_position = trim($monitor_position[1]);
             $monitor_position_x = substr($monitor_position, 0, strpos($monitor_position, ','));
             $monitor_position_y = substr($monitor_position, strpos($monitor_position, ',') + 1);
             if ($monitor_position == '0,0') {
                 $hit_0_0 = true;
             } else {
                 if ($monitor_position_x > 0 && $monitor_position_y == 0) {
                     array_push($monitor_layout, $hit_0_0 ? 'RIGHT' : 'LEFT');
                 } else {
                     if ($monitor_position_x == 0 && $monitor_position_y > 0) {
                         array_push($monitor_layout, $hit_0_0 ? 'LOWER' : 'UPPER');
                     }
                 }
             }
         }
         if (count($monitor_layout) == 1) {
             // Something went wrong with xdpy information, go to fallback support
             if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
                 $amdpcsdb_monitor_layout = phodevi_linux_parser::read_amd_pcsdb('SYSTEM/BUSID-*/DDX,DesktopSetup');
                 $amdpcsdb_monitor_layout = pts_arrays::to_array($amdpcsdb_monitor_layout);
                 foreach ($amdpcsdb_monitor_layout as $card_monitor_configuration) {
                     switch ($card_monitor_configuration) {
                         case 'horizontal':
                             array_push($monitor_layout, 'RIGHT');
                             break;
                         case 'horizontal,reverse':
                             array_push($monitor_layout, 'LEFT');
                             break;
                         case 'vertical':
                             array_push($monitor_layout, 'ABOVE');
                             break;
                         case 'vertical,reverse':
                             array_push($monitor_layout, 'BELOW');
                             break;
                     }
                 }
             }
         }
     }
     return implode(',', $monitor_layout);
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:50,代码来源:phodevi_monitor.php

示例12: __construct

 public function __construct($result_file, $selected_identifiers = null, $rename_identifier = null)
 {
     $this->result_file = $result_file;
     $this->selected_identifiers = $selected_identifiers != null ? pts_arrays::to_array($selected_identifiers) : null;
     $this->rename_identifier = $rename_identifier;
 }
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:6,代码来源:pts_result_merge_select.php

示例13: gpu_model

 public static function gpu_model()
 {
     // Report graphics processor string
     $info = phodevi_parser::read_glx_renderer();
     $video_ram = phodevi::read_property('gpu', 'memory-capacity');
     if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
         $crossfire_status = phodevi_linux_parser::read_amd_pcsdb('SYSTEM/Crossfire/chain/*,Enable');
         $crossfire_status = pts_arrays::to_array($crossfire_status);
         $crossfire_card_count = 0;
         for ($i = 0; $i < count($crossfire_status); $i++) {
             if ($crossfire_status[$i] == '0x00000001') {
                 $crossfire_card_count += 2;
                 // For now assume each chain is 2 cards, but proper way would be NumSlaves + 1
             }
         }
         $adapters = phodevi_linux_parser::read_amd_graphics_adapters();
         if (count($adapters) > 0) {
             $video_ram = $video_ram > 64 ? ' ' . $video_ram . 'MB' : null;
             // assume more than 64MB of vRAM
             if ($crossfire_card_count > 1 && $crossfire_card_count <= count($adapters)) {
                 $unique_adapters = array_unique($adapters);
                 if (count($unique_adapters) == 1) {
                     if (strpos($adapters[0], 'X2') > 0 && $crossfire_card_count > 1) {
                         $crossfire_card_count -= 1;
                     }
                     $info = $crossfire_card_count . ' x ' . $adapters[0] . $video_ram . ' CrossFire';
                 } else {
                     $info = implode(', ', $unique_adapters) . ' CrossFire';
                 }
             } else {
                 $info = $adapters[0] . $video_ram;
             }
         }
     } else {
         if (phodevi::is_macosx()) {
             $system_profiler_info = implode(' + ', phodevi_osx_parser::read_osx_system_profiler('SPDisplaysDataType', 'ChipsetModel', true));
             if (!empty($system_profiler_info)) {
                 $info = $system_profiler_info;
             }
         } else {
             if (phodevi::is_nvidia_graphics()) {
                 if ($info == null) {
                     if (pts_client::executable_in_path('nvidia-settings')) {
                         $nv_gpus = shell_exec('nvidia-settings -q gpus 2>&1');
                         // TODO: search for more than one GPU
                         $nv_gpus = substr($nv_gpus, strpos($nv_gpus, '[0]'));
                         $nv_gpus = substr($nv_gpus, strpos($nv_gpus, '(') + 1);
                         $nv_gpus = substr($nv_gpus, 0, strpos($nv_gpus, ')'));
                         if (stripos($nv_gpus, 'GeForce') !== false || stripos($nv_gpus, 'Quadro') !== false) {
                             $info = $nv_gpus;
                         }
                     }
                 }
                 $sli_mode = phodevi_parser::read_nvidia_extension('SLIMode');
                 if (!empty($sli_mode) && $sli_mode != 'Off') {
                     $info .= ' SLI';
                 }
             } else {
                 if (phodevi::is_solaris()) {
                     if (($cut = strpos($info, 'DRI ')) !== false) {
                         $info = substr($info, $cut + 4);
                     }
                     if (($cut = strpos($info, ' Chipset')) !== false) {
                         $info = substr($info, 0, $cut);
                     }
                     if ($info == false && isset(phodevi::$vfs->xorg_log)) {
                         $xorg_log = phodevi::$vfs->xorg_log;
                         if (($x = strpos($xorg_log, '(0): Chipset: ')) !== false) {
                             $xorg_log = substr($xorg_log, $x + 14);
                             $xorg_log = str_replace(array('(R)', '"'), null, substr($xorg_log, 0, strpos($xorg_log, PHP_EOL)));
                             if (($c = strpos($xorg_log, '[')) || ($c = strpos($xorg_log, '('))) {
                                 $xorg_log = substr($xorg_log, 0, $c);
                             }
                             if (phodevi::is_product_string($xorg_log)) {
                                 $info = $xorg_log;
                             }
                         }
                     }
                 } else {
                     if (phodevi::is_bsd()) {
                         $drm_info = phodevi_bsd_parser::read_sysctl('dev.drm.0.%desc');
                         if (!$drm_info) {
                             $drm_info = phodevi_bsd_parser::read_sysctl('dev.nvidia.0.%desc');
                         }
                         if (!$drm_info) {
                             $agp_info = phodevi_bsd_parser::read_sysctl('dev.agp.0.%desc');
                             if ($agp_info != false) {
                                 $info = $agp_info;
                             }
                         } else {
                             $info = $drm_info;
                         }
                         if ($info == null && isset(phodevi::$vfs->xorg_log)) {
                             $xorg_log = phodevi::$vfs->xorg_log;
                             if (($e = strpos($xorg_log, ' at 01@00:00:0')) !== false) {
                                 $xorg_log = substr($xorg_log, 0, $e);
                                 $info = substr($xorg_log, strrpos($xorg_log, 'Found ') + 6);
                             }
                         }
                     } else {
//.........这里部分代码省略.........
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:101,代码来源:phodevi_gpu.php

示例14: attached_modules

 public static function attached_modules($process_name = null, $select_modules = false)
 {
     if ($process_name == null) {
         $attached = self::$modules;
     } else {
         if (isset(self::$module_process[$process_name])) {
             $attached = self::$module_process[$process_name];
         } else {
             $attached = array();
         }
     }
     if ($select_modules != false) {
         $all_attached = $attached;
         $attached = array();
         foreach (pts_arrays::to_array($select_modules) as $check_module) {
             if (in_array($check_module, $all_attached)) {
                 array_push($attached, $check_module);
             }
         }
     }
     return $attached;
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:22,代码来源:pts_module_manager.php

示例15: identifiers_to_objects

 public static function identifiers_to_objects($identifiers, &$archive_unknown_objects = false)
 {
     // Provide an array containing the location(s) of all test(s) for the supplied object name
     $objects = array();
     foreach (pts_arrays::to_array($identifiers) as $identifier_item) {
         if ($identifier_item instanceof pts_test_profile || $identifier_item instanceof pts_test_suite || $identifier_item instanceof pts_result_file) {
             array_push($objects, $identifier_item);
         } else {
             if (PTS_IS_CLIENT && $identifier_item instanceof pts_virtual_test_queue) {
                 // Object is a virtual suite
                 array_push($objects, $identifier_item);
             } else {
                 if ($tp_identifier = pts_test_profile::is_test_profile($identifier_item)) {
                     // Object is a test
                     array_push($objects, new pts_test_profile($tp_identifier));
                 } else {
                     if (pts_test_suite::is_suite($identifier_item)) {
                         // Object is a suite
                         array_push($objects, new pts_test_suite($identifier_item));
                     } else {
                         if (pts_result_file::is_test_result_file($identifier_item)) {
                             // Object is a saved results file
                             array_push($objects, new pts_result_file($identifier_item));
                         } else {
                             if (pts_openbenchmarking::is_openbenchmarking_result_id($identifier_item)) {
                                 // Object is an OpenBenchmarking.org result
                                 // Clone it locally so it's just handled like a pts_result_file
                                 $success = pts_openbenchmarking::clone_openbenchmarking_result($identifier_item);
                                 if ($success) {
                                     array_push($objects, new pts_result_file($identifier_item));
                                 }
                             } else {
                                 if (PTS_IS_CLIENT && pts_virtual_test_suite::is_virtual_suite($identifier_item)) {
                                     // Object is a virtual suite
                                     array_push($objects, new pts_virtual_test_suite($identifier_item));
                                 } else {
                                     if (pts_suite_nye_XmlReader::is_temporary_suite($identifier_item)) {
                                         // Object is a suite
                                         array_push($objects, new pts_test_suite($identifier_item));
                                     } else {
                                         if (is_array($archive_unknown_objects)) {
                                             // Unknown / nothing / broken
                                             array_push($archive_unknown_objects, $identifier_item);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $objects;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:55,代码来源:pts_types.php


注:本文中的pts_arrays::to_array方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。