OSDN Git Service

[cleanup]php-cs-fixerによるコードの整形
authorHabu <habu@users.sourceforge.jp>
Thu, 12 Apr 2018 23:25:33 +0000 (08:25 +0900)
committerHabu <habu@users.sourceforge.jp>
Thu, 12 Apr 2018 23:25:33 +0000 (08:25 +0900)
score/custom_search.php
score/db_common.inc
score/dump_file.inc
score/feed_maker.inc
score/killer_ranking.php
score/popularity_ranking.php
score/register_score.php
score/score_ranking.php
score/show_dump.php
score/show_screen.php
score/web_template.inc

index 385f166..dab71ac 100644 (file)
@@ -29,7 +29,9 @@ $wt = new WebTemplate();
 $wt->set_title("変愚蛮怒 スコア カスタム検索");
 $fp = $wt->main_contents_fp();
 
-fwrite($fp, <<<EOM
+fwrite(
+    $fp,
+    <<<EOM
 <h2>変愚蛮怒 スコア カスタム検索</h2>
 <form action="score_ranking.php" method="GET">
 <p>
@@ -53,7 +55,9 @@ fwrite($fp, " <label for=\"realm_id2\">領域2:</label>");
 print_select_form($fp, $defines['realm'], 'realm_id2');
 fwrite($fp, "</p>\n");
 
-fwrite($fp, <<<EOM
+fwrite(
+    $fp,
+    <<<EOM
 <p>
 <label for="name">キャラクター名:</label>
 <input type="text" name="name">
index a4f5bac..95c4d1a 100644 (file)
@@ -3,7 +3,8 @@ class ScoreDB
 {
     private static $sort_mode_list = ['default' => 'score', 'newcome'];
 
-    public function __construct() {
+    public function __construct()
+    {
         $this->dbh = new PDO('sqlite:db/score.db');
         $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 
@@ -35,7 +36,7 @@ class ScoreDB
      */
     public function set_sort_mode($mode)
     {
-        if ($mode !== NULL && in_array($mode, self::$sort_mode_list)) {
+        if ($mode !== null && in_array($mode, self::$sort_mode_list)) {
             $this->sort_mode = $mode;
         } else {
             $this->sort_mode = self::$sort_mode_list['default'];
@@ -78,7 +79,7 @@ class ScoreDB
         $from_date = filter_input(INPUT_GET, 'fd');
         $to_date = filter_input(INPUT_GET, 'td');
 
-        if ($from_date !== NULL && $to_date !== NULL &&
+        if ($from_date !== null && $to_date !== null &&
             strlen($from_date) > 0 && strlen($to_date) > 0) {
             $wheres[] = "(date >= date(:from_date) AND date < date(:to_date, '+1 days'))";
             $params[":from_date"] = $from_date;
@@ -86,7 +87,7 @@ class ScoreDB
         }
 
         foreach (['race_id', 'class_id', 'personality_id'] as $key_column) {
-            $val = filter_input(INPUT_GET, $key_column, FILTER_VALIDATE_INT); 
+            $val = filter_input(INPUT_GET, $key_column, FILTER_VALIDATE_INT);
             if ($val > 0) {
                 $wheres[] = "{$key_column} = :{$key_column}";
                 $params[":{$key_column}"] = $val;
@@ -94,7 +95,7 @@ class ScoreDB
         }
 
         foreach (['realm_id1', 'realm_id2'] as $idx => $key_column) {
-            $val = filter_input(INPUT_GET, $key_column, FILTER_VALIDATE_INT); 
+            $val = filter_input(INPUT_GET, $key_column, FILTER_VALIDATE_INT);
             if ($val > 0) {
                 $seq = $idx + 1;
                 $wheres[] = "score_id IN (SELECT score_id FROM score_realms WHERE realm_id = :{$key_column} AND realm_seq = {$seq})";
@@ -105,15 +106,15 @@ class ScoreDB
         foreach (['name'] as $key_column) {
             $val = filter_input(INPUT_GET, $key_column);
             $match_mode = filter_input(INPUT_GET, $key_column."_match");
-            if ($val !== NULL && strlen($val) > 0) {
+            if ($val !== null && strlen($val) > 0) {
                 $wheres[] = ($match_mode == "strict") ? "{$key_column} = :{$key_column}" : "{$key_column} LIKE :{$key_column}";
                 $params[":{$key_column}"] = ($match_mode == "strict") ? $val : "%".$val."%";
             }
         }
 
         foreach (['sex'] as $key_column) {
-            $val = filter_input(INPUT_GET, $key_column, FILTER_VALIDATE_INT); 
-            if ($val !== FALSE && $val !== NULL) {
+            $val = filter_input(INPUT_GET, $key_column, FILTER_VALIDATE_INT);
+            if ($val !== false && $val !== null) {
                 $wheres[] = "{$key_column} = :{$key_column}";
                 $params[":{$key_column}"] = $val;
             }
@@ -121,7 +122,7 @@ class ScoreDB
 
         foreach (['killer'] as $key_column) {
             $val = filter_input(INPUT_GET, $key_column);
-            if ($val !== NULL && strlen($val) > 0) {
+            if ($val !== null && strlen($val) > 0) {
                 $wheres[] = "({$key_column} LIKE :{$key_column} OR {$key_column} = :{$key_column}1 OR {$key_column} = :{$key_column}2)";
                 $params[":{$key_column}"] = "%".$val."%";
                 $params[":{$key_column}1"] = "麻痺状態で".$val;
@@ -256,14 +257,16 @@ EOM;
         return $result;
     }
 
-    public function get_db_handle() {
+    public function get_db_handle()
+    {
         return $this->dbh;
     }
 
     private function update_killers_cache_table()
     {
         $this->dbh->exec("DROP TABLE IF EXISTS killers_cache");
-        $this->dbh->exec(<<<EOM
+        $this->dbh->exec(
+            <<<EOM
 CREATE TABLE
   killers_cache
 AS
@@ -322,7 +325,8 @@ EOM
      * 種族・職業・性格について各種統計情報を取得しキャッシュテーブルに保存する
      * 通常の統計情報の取得はこのキャッシュテーブルから行う
      */
-    private function update_statistics_cache_tables() {
+    private function update_statistics_cache_tables()
+    {
         $statistics_list = ['race', 'class', 'personality'];
 
         foreach ($statistics_list as $stat) {
@@ -353,7 +357,8 @@ EOM
      * 魔法領域1・魔法領域2について各種統計情報を取得しキャッシュテーブルに保存する
      * 通常の統計情報の取得はこのキャッシュテーブルから行う
      */
-    private function update_realm_statistics_cache_tables() {
+    private function update_realm_statistics_cache_tables()
+    {
         foreach (range(1, 2) as $seq) {
             $table_name = "realm{$seq}_statistics";
             $this->dbh->exec("DROP TABLE IF EXISTS ".$table_name);
@@ -389,7 +394,8 @@ EOM
      *
      * @return array 統計情報
      */
-    public function get_statistics_tables($sort_key_column) {
+    public function get_statistics_tables($sort_key_column)
+    {
         try {
             $this->dbh->beginTransaction();
             if (!$this->get_cache_status('statistics_cache')) {
@@ -455,7 +461,8 @@ EOM
 
     public function create_cache_status_table()
     {
-        $this->dbh->exec(<<<EOM
+        $this->dbh->exec(
+            <<<EOM
 CREATE TABLE cache_status_table
   (table_name TEXT PRIMARY KEY,
    cached BOOLEAN)
@@ -501,10 +508,10 @@ EOM
 
         try {
             $this->dbh->beginTransaction();
-            if ($insert_stmt->execute($score_data['character_info']) === FALSE ||
+            if ($insert_stmt->execute($score_data['character_info']) === false ||
                 $insert_stmt->rowCount() !== 1) {
                 $dbh->rollBack();
-                return FALSE;
+                return false;
             }
 
             // NOTE: score_idはINTEGER PRIMARY KEYなのでROWIDを参照している
@@ -512,10 +519,10 @@ EOM
             $score_id = $this->dbh->lastInsertId();
 
             foreach ($score_data['realm_info'] as $realm_seq => $realm_name) {
-                if ($realm_insert_stmt->execute([$score_id, $realm_seq + 1, $realm_name]) === FALSE ||
+                if ($realm_insert_stmt->execute([$score_id, $realm_seq + 1, $realm_name]) === false ||
                     $realm_insert_stmt->rowCount() !== 1) {
                     $dbh->rollBack();
-                    return FALSE;
+                    return false;
                 }
             }
 
@@ -529,7 +536,7 @@ EOM
             $dbh->rollBack();
         }
 
-        return FALSE;
+        return false;
     }
 
 
@@ -544,8 +551,8 @@ EOM
      */
     public function update_dead_place($score_id, $dead_place)
     {
-        if ($dead_place === FALSE) {
-            return FALSE;
+        if ($dead_place === false) {
+            return false;
         }
         $stmt = $this->dbh->prepare(
             <<<EOM
index 72ec4c6..800cf04 100644 (file)
@@ -1,9 +1,10 @@
 <?php
 class DumpFile
 {
-    public function __construct($score_id) {
+    public function __construct($score_id)
+    {
         $this->score_id = $score_id;
-        $this->dump_lines = NULL;
+        $this->dump_lines = null;
     }
 
 
@@ -35,7 +36,7 @@ class DumpFile
         header("Etag: ".$etag);
         header("Content-Type: ".$content_type);
 
-        if ($content_encoding !== NULL) {
+        if ($content_encoding !== null) {
             header("Content-Encoding: ".$content_encoding);
             echo $contents;
         } else {
@@ -46,7 +47,9 @@ class DumpFile
 
     public function save($dir, $ext, $contents)
     {
-        if ($contents === FALSE) return;
+        if ($contents === false) {
+            return;
+        }
 
         umask(2); // Group書き込み権限許可
 
@@ -54,7 +57,7 @@ class DumpFile
         $dirname = dirname($filename);
 
         if (!file_exists($dirname)) {
-            mkdir($dirname, 02775, TRUE);
+            mkdir($dirname, 02775, true);
         }
 
         $zp = gzopen($filename, "w9");
@@ -85,17 +88,17 @@ class DumpFile
      */
     private function readlines()
     {
-        if ($this->dump_lines !== NULL) {
-            return TRUE;
+        if ($this->dump_lines !== null) {
+            return true;
         }
 
         $lines = gzfile($this->get_filename('dumps', 'txt'));
-        if ($lines !== FALSE) {
+        if ($lines !== false) {
             $this->dump_lines = $lines;
-            return TRUE;
+            return true;
         }
 
-        return FALSE;
+        return false;
     }
 
 
@@ -106,19 +109,18 @@ class DumpFile
      */
     public function get_last_message()
     {
-        if ($this->readlines() === FALSE) {
+        if ($this->readlines() === false) {
             return [];
         }
 
-        $in_message = FALSE;
+        $in_message = false;
         $result = [];
         foreach ($this->dump_lines as $line) {
             if (preg_match('/^\s*\[(.*)\]\s*$/u', $line, $matches)) {
                 if ($matches[1] == '*勝利*メッセージ' ||
                     $matches[1] == '死ぬ直前のメッセージ') {
-                    $in_message = TRUE;
-                }
-                else if ($in_message) {
+                    $in_message = true;
+                } elseif ($in_message) {
                     break;
                 }
             }
@@ -139,8 +141,8 @@ class DumpFile
      */
     public function get_death_reason_detail()
     {
-        if ($this->readlines() === FALSE) {
-            return FALSE;
+        if ($this->readlines() === false) {
+            return false;
         }
 
         $death_reason_lines = array_slice($this->dump_lines, 30, 3);
@@ -149,7 +151,7 @@ class DumpFile
         if (preg_match("/^…あなたは、?(.+)。/u", $death_reason, $matches)) {
             return $matches[1];
         } else {
-            return FALSE;
+            return false;
         }
     }
 
@@ -162,10 +164,9 @@ class DumpFile
      */
     public function get_dead_place()
     {
-
         $death_reason_detail = $this->get_death_reason_detail();
-        if ($death_reason_detail === FALSE) {
-            return FALSE;
+        if ($death_reason_detail === false) {
+            return false;
         }
         $places = implode("|", [
             "階", "荒野", "地上", "街",
@@ -173,11 +174,14 @@ class DumpFile
             "クエスト「.+」", "クエスト",
         ]);
 
-        if (preg_match("/^(.*(?:{$places})\s*)で.+$/u",
-                        $death_reason_detail, $matches)) {
+        if (preg_match(
+            "/^(.*(?:{$places})\s*)で.+$/u",
+            $death_reason_detail,
+            $matches
+        )) {
             return $matches[1];
         } else {
-            return FALSE;
+            return false;
         }
     }
 
@@ -185,7 +189,9 @@ class DumpFile
     private static function browser_accept_encodings()
     {
         $accept_encoding = filter_input(INPUT_SERVER, 'HTTP_ACCEPT_ENCODING');
-        if ($accept_encoding == NULL) return [];
+        if ($accept_encoding == null) {
+            return [];
+        }
 
         return array_map('trim', explode(",", $accept_encoding));
     }
@@ -195,9 +201,9 @@ class DumpFile
     {
         $supported_gzip_encodings = array_intersect(
             self::browser_accept_encodings(),
-            ['gzip', 'x-gzip']);
+            ['gzip', 'x-gzip']
+        );
 
         return array_shift($supported_gzip_encodings);
     }
-
 }
index 8e3a1a7..b8a7125 100644 (file)
@@ -39,7 +39,7 @@ class FeedMaker
 
             $dump_file = new DumpFile($s['score_id']);
             $death_reason_detail = $dump_file->get_death_reason_detail();
-            if ($death_reason_detail === FALSE) {
+            if ($death_reason_detail === false) {
                 $death_reason_detail = "{$s['death_reason']} @{$s['depth']}F";
             }
 
index c6cc31b..13b85a3 100644 (file)
@@ -24,7 +24,9 @@ $wt->add_head_contents('<link rel="stylesheet" type="text/css" href="css/score-t
 $wt->set_title("変愚蛮怒 スコア 死因ランキング");
 
 $fp = $wt->main_contents_fp();
-fwrite($fp, <<<EOM
+fwrite(
+    $fp,
+    <<<EOM
 <h2>変愚蛮怒 死因ランキング</h2>
 <table class="score">
 <thead>
@@ -42,7 +44,9 @@ fwrite($fp, "<tboby>\n");
 foreach ($killers as $k) {
     //$freeze = $k['killer_count_freeze'] > 0 ? "(".$k['killer_count_freeze'].")" : "";
     $killer_name = h($k['killer_name']);
-    fwrite($fp, <<<EOM
+    fwrite(
+        $fp,
+        <<<EOM
 <tr>
 <td class="number">{$k['killer_count_total']}</td>
 <td class="number">{$k['killer_count_freeze']}</td>
index 9afbf13..bac4509 100644 (file)
@@ -11,7 +11,9 @@ require_once "web_template.inc";
 
 function print_popularity_table($fp, $stat, $id_name, $name)
 {
-    fwrite($fp, <<<EOM
+    fwrite(
+        $fp,
+        <<<EOM
 <div id="{$id_name}">
 <table class="tablesorter score statistics_table">
 <thead>
@@ -20,7 +22,7 @@ function print_popularity_table($fp, $stat, $id_name, $name)
 
 EOM
     );
-    
+
     foreach ([
         '計', '男性', '女性', '勝利', '平均スコア', '最大スコア',
     ] as $name) {
@@ -31,7 +33,9 @@ EOM
 
     foreach ($stat as $k => $s) {
         $name_link = "<a href='score_ranking.php?{$id_name}={$s['id']}'>{$s['name']}</a></td>";
-        fwrite($fp, <<<EOM
+        fwrite(
+            $fp,
+            <<<EOM
 <tr>
 <td>$name_link</td>
 <td class="number">{$s['total_count']}</td>
@@ -64,11 +68,15 @@ function print_realm_popularity_table($fp, $stat, $id_name)
 
     // 職業ごとにテーブルを表示
     foreach ($class_realm_stat_list as $class_id => $class_realm_stat) {
-        if (count($class_realm_stat) <= 1) continue; // 領域固定の職業は飛ばす
+        if (count($class_realm_stat) <= 1) {
+            continue; // 領域固定の職業は飛ばす
+        }
 
         $class_name = $class_realm_stat[0]['class_name'];
 
-        fwrite($fp, <<<EOM
+        fwrite(
+            $fp,
+            <<<EOM
 <table class="tablesorter score statistics_table" id="${id_name}">
 <thead>
 <tr>
@@ -86,7 +94,9 @@ EOM
 
         foreach ($class_realm_stat as $realm) {
             $name_link = "<a href='score_ranking.php?class_id={$class_id}&{$id_name}={$realm['realm_id']}'>{$realm['realm_name']}</a></td>";
-            fwrite($fp, <<<EOM
+            fwrite(
+                $fp,
+                <<<EOM
 <tr>
 <td>$name_link</td>
 <td class="number">{$realm['total_count']}</td>
@@ -134,7 +144,9 @@ $wt->set_title("変愚蛮怒 スコアランキング 人気のある種族・
 $fp = $wt->main_contents_fp();
 fwrite($fp, "<h2>人気のある種族・職業・性格・魔法領域</h2>\n");
 //fprintf($fp, "<small>(%.2f 秒)</small>", $query_time);
-fwrite($fp, <<<EOM
+fwrite(
+    $fp,
+    <<<EOM
 <nobr>[ <a href="javascript:void(0)" class="table_select" id="race_id">種族</a> | <a href="javascript:void(0)" class="table_select" id="class_id">職業</a> | <a href="javascript:void(0)" class="table_select" id="personality_id">性格</a> ] [ <a href="javascript:void(0)" class="table_select" id="realm_id1">魔法領域1</a> | <a href="javascript:void(0)" class="table_select" id="realm_id2">魔法領域2</a> ]</nobr>
 
 EOM
index a913fd0..7678e45 100644 (file)
@@ -20,15 +20,20 @@ http_response_code(400);
  * @return string|false 送られてきたスコアの、PHPのマルチバイト文字処理における文字エンコーディングを表す文字列
  *                      取得できなかった場合はFALSE
  */
-function get_mb_encoding(){
+function get_mb_encoding()
+{
     $content_type = filter_input(INPUT_SERVER, 'CONTENT_TYPE');
-    if ($content_type == NULL) return FALSE;
+    if ($content_type == null) {
+        return false;
+    }
 
     $s = explode(';', $content_type);
 
     if (count($s) != 2 ||
         $s[0] !== "text/plain" ||
-        strpos(trim($s[1]), "charset=") !== 0) return FALSE;
+        strpos(trim($s[1]), "charset=") !== 0) {
+        return false;
+    }
 
     $c = explode('=', $s[1]);
 
@@ -40,7 +45,7 @@ function get_mb_encoding(){
     case "utf-8":
         return "UTF-8";
     default:
-        return FALSE;
+        return false;
     }
 }
 
@@ -62,20 +67,22 @@ function split_recv_contents($recv_contents)
     $dump_info_end_line = array_search('-----charcter dump-----', $recv_lines);
     $dump_txt_end_line = array_search('-----screen shot-----', $recv_lines);
 
-    if ($dump_info_end_line === FALSE) return FALSE;
+    if ($dump_info_end_line === false) {
+        return false;
+    }
 
     $info_lines = array_slice($recv_lines, 0, $dump_info_end_line);
     $dump_lines = array_slice(
         $recv_lines,
         $dump_info_end_line + 1,
-        $dump_txt_end_line ? $dump_txt_end_line - $dump_info_end_line - 1: NULL
+        $dump_txt_end_line ? $dump_txt_end_line - $dump_info_end_line - 1: null
     );
     $screen_lines = $dump_txt_end_line ?
                   array_slice(
                       $recv_lines,
                       $dump_txt_end_line + 1,
-                      NULL
-                  ) : FALSE;
+                      null
+                  ) : false;
 
     return [$info_lines, $dump_lines, $screen_lines];
 }
@@ -96,7 +103,7 @@ function parse_character_info($info_lines)
     $info = [];
     foreach ($info_lines as $l) {
         $splitpos = strpos($l, ':');
-        if ($splitpos !== FALSE) {
+        if ($splitpos !== false) {
             $key = substr($l, 0, $splitpos);
             $val = substr($l, $splitpos + 1);
             $info[$key] = trim($val);
@@ -136,7 +143,10 @@ function create_db_insert_score_data($info)
     $realm_info_array = array_values(
         array_filter(
             [$info['realm1'], $info['realm2']],
-            function($v) {return $v !== '魔法なし';})
+            function ($v) {
+                return $v !== '魔法なし';
+            }
+        )
     );
 
     return [
@@ -157,20 +167,23 @@ function create_db_insert_score_data($info)
  */
 function validate_screen_dump($screen_dump_lines)
 {
-    if ($screen_dump_lines === FALSE) {
-        return FALSE;
+    if ($screen_dump_lines === false) {
+        return false;
     }
 
     $allow_tags = ['html', 'body', 'pre', 'font'];
 
-    $is_valid = TRUE;
+    $is_valid = true;
     foreach ($screen_dump_lines as $line) {
         if (preg_match_all("|</?([^>\s]+)(\s*[^>]+)?>|", $line, $matches, PREG_SET_ORDER) > 0) {
-            $invalid_tag_matches = array_filter($matches, function($m) use($allow_tags) {
-                return !in_array($m[1], $allow_tags);
-            });
+            $invalid_tag_matches = array_filter(
+                $matches,
+                function ($m) use ($allow_tags) {
+                    return !in_array($m[1], $allow_tags);
+                }
+            );
             if (count($invalid_tag_matches) > 0) {
-                $is_valid = FALSE;
+                $is_valid = false;
             }
         }
     }
@@ -180,7 +193,7 @@ function validate_screen_dump($screen_dump_lines)
 
 
 $recv_encoding = get_mb_encoding();
-if ($recv_encoding === FALSE) {
+if ($recv_encoding === false) {
     exit;
 }
 
@@ -192,7 +205,7 @@ if (strlen($recv_contents) !== filter_input(INPUT_SERVER, 'CONTENT_LENGTH', FILT
 $recv_contents = mb_convert_encoding($recv_contents, "UTF-8", $recv_encoding);
 
 $split_contents = split_recv_contents($recv_contents);
-if ($split_contents === FALSE) {
+if ($split_contents === false) {
     exit;
 }
 
@@ -201,7 +214,7 @@ $char_info = parse_character_info($split_contents[0]);
 $db = new ScoreDB();
 $score_id = $db->register_new_score(create_db_insert_score_data($char_info));
 
-if ($score_id === FALSE) {
+if ($score_id === false) {
     exit;
 }
 
index 7a2cddf..82fc195 100644 (file)
@@ -48,11 +48,13 @@ function calc_page_info($total_data_count, $start_num, $data_count_per_page)
  */
 function print_navi_page_table($fp, $pageinfo)
 {
-    if (count($pageinfo['navi_list']) <= 1) return;
+    if (count($pageinfo['navi_list']) <= 1) {
+        return;
+    }
 
     $href_base = filter_input(INPUT_SERVER, 'SCRIPT_NAME')."?"
                .preg_replace('/(&?start=\w+)/', '', filter_input(INPUT_SERVER, 'QUERY_STRING'));
-    if (strpos($href_base, "?") === FALSE) {
+    if (strpos($href_base, "?") === false) {
         $href_base .= "?";
     }
 
@@ -93,7 +95,9 @@ function print_navi_page_table($fp, $pageinfo)
  */
 function print_score_table($fp, $scores, $rank_start)
 {
-    fwrite($fp, <<<EOM
+    fwrite(
+        $fp,
+        <<<EOM
 <table class="score">
 <thead>
 <tr>
@@ -112,7 +116,7 @@ EOM
     );
 
     fwrite($fp, "<tbody>\n");
-    foreach($scores as $idx => $score) {
+    foreach ($scores as $idx => $score) {
         $rank = $rank_start + $idx + 1;
         $date = substr($score['date'], 0, 10); // 日時から日付部分を取り出す
         $sex_str = $score['sex'] ? "男" : "女";
@@ -124,7 +128,9 @@ EOM
         if ($dumpfile->exists('dumps', 'txt')) {
             $name = "<a href=\"show_dump.php?score_id={$score['score_id']}\">{$name}</a>";
         }
-        fwrite($fp, <<<EOM
+        fwrite(
+            $fp,
+            <<<EOM
 <tr>
 <td>$rank</td>
 <td class="number">{$score['score']}</td>
@@ -163,7 +169,9 @@ $wt->add_head_contents('<meta name="robots" content="none" />');
 $wt->add_head_contents('<link rel="stylesheet" type="text/css" href="css/score-table.css">');
 $fp = $wt->main_contents_fp();
 fprintf($fp, "<h2>変愚蛮怒 歴代スコア (%s)</h2>\n", $db->get_sort_mode_name());
-fprintf($fp, <<<EOM
+fprintf(
+    $fp,
+    <<<EOM
 <div align="right">
 <small>
 件数 %d 件 (%.2f 秒)
@@ -171,7 +179,9 @@ fprintf($fp, <<<EOM
 </div>
 
 EOM
-        ,$search_result['total_data_count'], $search_result['elapsed_time']
+    ,
+    $search_result['total_data_count'],
+    $search_result['elapsed_time']
 );
 
 print_navi_page_table($fp, $pageinfo);
index d4a020e..9ffbefc 100644 (file)
@@ -7,7 +7,7 @@ ini_set('error_log', 'errors/'.pathinfo(__FILE__, PATHINFO_FILENAME).'.log');
 require_once "dump_file.inc";
 
 $score_id = filter_input(INPUT_GET, 'score_id', FILTER_VALIDATE_INT);
-if ($score_id === FALSE || $score_id === NULL) {
+if ($score_id === false || $score_id === null) {
     http_response_code(404);
 } else {
     $dump_file = new DumpFile($score_id);
index d6c6ffc..9b1738b 100644 (file)
@@ -7,7 +7,7 @@ ini_set('error_log', 'errors/'.pathinfo(__FILE__, PATHINFO_FILENAME).'.log');
 require_once "dump_file.inc";
 
 $score_id = filter_input(INPUT_GET, 'score_id', FILTER_VALIDATE_INT);
-if ($score_id === FALSE || $score_id === NULL) {
+if ($score_id === false || $score_id === null) {
     http_response_code(404);
 } else {
     $dump_file = new DumpFile($score_id);
index c63101e..f2b4e22 100644 (file)
@@ -12,7 +12,8 @@ class WebTemplate
 {
     private static $template_dir = "../template";
 
-    public function __construct() {
+    public function __construct()
+    {
         $this->template = file(self::$template_dir."/template.html");
         $this->head = file(self::$template_dir."/head.html");
         $this->header = file(self::$template_dir."/header.html");
@@ -61,7 +62,8 @@ class WebTemplate
     /**
      * Webページを出力する
      */
-    public function print_page() {
+    public function print_page()
+    {
         rewind($this->main_contents_fp);
         $this->main_contents = [stream_get_contents($this->main_contents_fp)];
         foreach ($this->template as $line) {
@@ -83,9 +85,10 @@ class WebTemplate
         }
     }
 
-    private static function print_page_sub($lines) {
-        foreach ($lines as $line){
+    private static function print_page_sub($lines)
+    {
+        foreach ($lines as $line) {
             echo $line;
-        } 
+        }
     }
 }