php / php/php-src

Feature: walker function: walker(".") returns an object model of the entire directory / an expansive alternative for scandir()

オープン
#22,104 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Feature Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

Description

Here is my current code for demonstrating the purpose. The dev community shall decide on the final verdict.

<?php
    function walker($directory) {
        foreach (scandir($directory) as $item) {
            if ($item == '.' || $item == '..') continue;
            if ($directory == "." && ($item == "api.php" || $item == 'index.html')) continue;
            $dl[$item] = [
                "item_type" => is_dir("{$directory}/{$item}") ? "folder" : "file",
                "child" => walker("{$directory}/{$item}"),
            ];
        }
        return $dl;
    }
?>

Here's how I'm currently using it :) with some html css and js
Image

How it looks like when I use echo and json_encode.
Image

I'll be making a pull request if it got a lot of good impressions.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、再帰的なディレクトリ走査を行うために提案されている walker($directory) の例と、その想定オブジェクトモデルを確認します。要求を既存の scandir() の動作と比較し、具体的な PHP API、スコープ、完了基準を定義できるか判断してください。この issue では現在、ソースファイルもテストも指定されていません。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。