Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/mock-fs.php

    r46586 r47122  
    66        private $fs = null;
    77
    8         // Holds a array of /path/to/file.php and /path/to/dir/ map to an object in $fs above
    9         // a fast more efficient way of determining if a path exists, and access to that node
     8        // Holds a array of /path/to/file.php and /path/to/dir/ map to an object in $fs above.
     9        // A fast, more efficient way of determining if a path exists, and access to that node.
    1010        private $fs_map = array();
    1111
     
    2727                $folder = $this->find_folder( $path );
    2828
    29                 // Perhaps the FTP folder is rooted at the WordPress installation, Check for wp-includes folder in root, Could have some false positives, but rare.
     29                // Perhaps the FTP folder is rooted at the WordPress installation.
     30                // Check for wp-includes folder in root, could have some false positives, but rare.
    3031                if ( ! $folder && $this->is_dir( '/wp-includes' ) ) {
    3132                        $folder = '/';
     
    3435        }
    3536
    36         // Mock FS specific functions:
     37        // Mock FS-specific functions:
    3738
    3839        /**
     
    4546                        '/' => $this->fs,
    4647                );
    47                 $this->cache  = array(); // Used by find_folder() and friends
     48                $this->cache  = array(); // Used by find_folder() and friends.
    4849                $this->cwd    = isset( $this->fs_map[ $home_dir ] ) ? $this->fs_map[ $home_dir ] : '/';
    4950                $this->setfs( $paths );
     
    6162
    6263                foreach ( $paths as $path ) {
    63                         // Allow for comments
     64                        // Allow for comments.
    6465                        if ( '#' === $path[0] ) {
    6566                                continue;
    6667                        }
    6768
    68                         // Directories
     69                        // Directories.
    6970                        if ( '/' === $path[ strlen( $path ) - 1 ] ) {
    7071                                $this->mkdir( $path );
    71                         } else { // Files (with dummy content for now)
     72                        } else { // Files (with dummy content for now).
    7273                                $this->put_contents( $path, 'This is a test file' );
    7374                        }
     
    210211
    211212class MockFS_Node {
    212         public $name; // The "name" of the entry, does not include a slash (exception, root)
    213         public $type; // The type of the entry 'f' for file, 'd' for Directory
     213        public $name; // The "name" of the entry, does not include a slash (exception, root).
     214        public $type; // The type of the entry 'f' for file, 'd' for directory.
    214215        public $path; // The full path to the entry.
    215216
     
    230231class MockFS_Directory_Node extends MockFS_Node {
    231232        public $type     = 'd';
    232         public $children = array(); // The child nodes of this directory
     233        public $children = array(); // The child nodes of this directory.
    233234}
    234235
    235236class MockFS_File_Node extends MockFS_Node {
    236237        public $type     = 'f';
    237         public $contents = ''; // The contents of the file
     238        public $contents = ''; // The contents of the file.
    238239
    239240        function __construct( $path, $contents = '' ) {
Note: See TracChangeset for help on using the changeset viewer.