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


PHP pts_strings::remove_from_string方法代码示例

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


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

示例1: compact_result_file_test_object

 public static function compact_result_file_test_object(&$mto, &$result_table = false, &$result_file, $extra_attributes = null)
 {
     $identifiers_inverted = $result_file && $result_file->is_multi_way_inverted();
     // TODO: this may need to be cleaned up, its logic is rather messy
     $condense_multi_way = isset($extra_attributes['condense_multi_way']);
     if (count($mto->test_profile->get_result_scale_offset()) > 0) {
         // It's already doing something
         return;
     }
     $scale_special = array();
     $days = array();
     $systems = array();
     $prev_date = null;
     $is_tracking = true;
     $sha1_short_count = 0;
     $buffer_count = $mto->test_result_buffer->get_count();
     if ($identifiers_inverted) {
         $system_index = 0;
         $date_index = 1;
     } else {
         $system_index = 1;
         $date_index = 0;
     }
     foreach ($mto->test_result_buffer->get_buffer_items() as $buffer_item) {
         $identifier = array_map('trim', explode(':', $buffer_item->get_result_identifier()));
         switch (count($identifier)) {
             case 2:
                 $system = $identifier[$system_index];
                 $date = $identifier[$date_index];
                 break;
             case 1:
                 $system = 0;
                 $date = $identifier[0];
                 break;
             default:
                 return;
                 break;
         }
         if (!isset($systems[$system])) {
             $systems[$system] = 0;
         }
         if (!isset($days[$date])) {
             $days[$date] = null;
         }
         if ($is_tracking) {
             // First do a dirty SHA1 hash check
             if (strlen($date) != 40 || strpos($date, ' ') !== false) {
                 if (($x = strpos($date, ' + ')) !== false) {
                     $date = substr($date, 0, $x);
                 }
                 // Check to see if only numeric changes are being made
                 $sha1_short_hash_ending = isset($date[7]) && ctype_alnum(substr($date, -8));
                 $date = str_replace('s', null, pts_strings::remove_from_string($date, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DASH | pts_strings::CHAR_DECIMAL));
                 if ($sha1_short_hash_ending) {
                     $sha1_short_count++;
                 }
                 if ($prev_date != null && $date != $prev_date && $sha1_short_hash_ending == false && $sha1_short_count < 3) {
                     $is_tracking = false;
                 }
                 $prev_date = $date;
             }
         }
     }
     if ($is_tracking) {
         $prev_date_r = explode(' ', $prev_date);
         if (count($prev_date_r) == 2 && ctype_alpha($prev_date_r[0])) {
             // This check should make it so when like testing every Ubuntu releases (Ubuntu 11.04, Ubuntu 11.10, etc) it's not in a line graph
             $is_tracking = false;
         }
     } else {
         if ($is_tracking == false && $sha1_short_count > 5) {
             // It's probably actually tracking..... based upon Stefan's Wine 1.4 example on 15 March 2012
             $is_tracking = true;
         }
     }
     foreach (array_keys($days) as $day_key) {
         $days[$day_key] = $systems;
     }
     $raw_days = $days;
     $json_days = $days;
     foreach ($mto->test_result_buffer->get_buffer_items() as $buffer_item) {
         $identifier = array_map('trim', explode(':', $buffer_item->get_result_identifier()));
         switch (count($identifier)) {
             case 2:
                 $system = $identifier[$system_index];
                 $date = $identifier[$date_index];
                 break;
             case 1:
                 $system = 0;
                 $date = $identifier[0];
                 break;
             default:
                 return;
                 break;
         }
         $days[$date][$system] = $buffer_item->get_result_value();
         $raw_days[$date][$system] = $buffer_item->get_result_raw();
         $json_days[$date][$system] = $buffer_item->get_result_json();
         if (!is_numeric($days[$date][$system])) {
             return;
//.........这里部分代码省略.........
开发者ID:xorgy,项目名称:phoronix-test-suite,代码行数:101,代码来源:pts_render.php

示例2: is_results_tracker

 public function is_results_tracker()
 {
     // If there are more than five results and the only changes in the system identifier names are numeric changes, assume it's a tracker
     // i.e. different dates or different versions of a package being tested
     if ($this->is_tracker === -1) {
         $identifiers = $this->get_system_identifiers();
         if (isset($identifiers[5])) {
             // dirty SHA1 hash check
             $is_sha1_hash = strlen($identifiers[0]) == 40 && strpos($identifiers[0], ' ') === false;
             $has_sha1_shorthash = false;
             foreach ($identifiers as $i => &$identifier) {
                 $has_sha1_shorthash = ($i == 0 || $has_sha1_shorthash) && isset($identifier[7]) && pts_strings::string_only_contains(substr($identifier, -8), pts_strings::CHAR_NUMERIC | pts_strings::CHAR_LETTER) && strpos($identifier, ' ') === false;
                 $identifier = pts_strings::remove_from_string($identifier, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DASH | pts_strings::CHAR_DECIMAL);
             }
             $this->is_tracker = count(array_unique($identifiers)) <= 1 || $is_sha1_hash || $has_sha1_shorthash;
             if ($this->is_tracker) {
                 $hw = $this->get_system_hardware();
                 if (isset($hw[1]) && count($hw) == count(array_unique($hw))) {
                     // it can't be a results tracker if the hardware is always different
                     $this->is_tracker = false;
                 }
             }
             if ($this->is_tracker == false) {
                 // See if only numbers are changing between runs
                 foreach ($identifiers as $i => &$identifier) {
                     if (($x = strpos($identifier, ': ')) !== false) {
                         $identifier = substr($identifier, $x + 2);
                     }
                     if ($i > 0 && pts_strings::remove_from_string($identifier, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL) != pts_strings::remove_from_string($identifiers[$i - 1], pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL)) {
                         return false;
                     }
                 }
                 $this->is_tracker = true;
             }
         } else {
             // Definitely not a tracker as not over 5 results
             $this->is_tracker = false;
         }
     }
     return $this->is_tracker;
 }
开发者ID:jsavikko,项目名称:phoronix-test-suite,代码行数:41,代码来源:pts_result_file.php


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