<commit_before><?php

    require_once 'Sabre/DAV/FS/Node.php';
    require_once 'Sabre/DAV/IDirectory.php';

    /**
     * Directory class 
     * 
     * @package Sabre
     * @subpackage DAV
     * @version $Id$
     * @copyright Copyright (C) 2007, 2008 Rooftop Solutions. All rights reserved.
     * @author <NAME> (http://www.rooftopsolutions.nl/) 
     * @license licence http://www.freebsd.org/copyright/license.html  BSD License (4 Clause)
     */
    class Sabre_DAV_FS_Directory extends Sabre_DAV_FS_Node implements Sabre_DAV_IDirectory {

        /**
         * Creates a new file in the directory 
         * 
         * @param string $name Name of the file 
         * @param string $data Initial payload 
         * @return void
         */
        public function createFile($name, $data = null) {

            $newPath = $this->path . '/' . $name;
            file_put_contents($newPath,$data);

        }

        /**
         * Creates a new subdirectory 
         * 
         * @param string $name 
         * @return void
         */
        public function createDirectory($name) {

            $newPath = $this->path . '/' . $name;
            mkdir($newPath);

        }

        /**
         * Returns a specific child node, referenced by its name 
         * 
         * @param string $name 
         * @return Sabre_DAV_INode 
         */
        public function getChild($name) {

            $path = $this->path . '/' . $name;
            if (is_dir($name)) {

                return new Sabre_DAV_FS_Directory($path);

            } else {

                return new Sabre_DAV_FS_File($path);

            }

        }

        /**
         * Returns an array with all the child nodes 
         * 
         * @return Sabre_DAV_INode[] 
         */
        public function getChildren() {

            $nodes = array();
            foreach(scandir($this->path) as $node) $nodes[] = $this->getChild($node);
            return $nodes;

        }

    }

?><commit_msg>Fixed scanning for . and .. Added check if node exists Fixed determining if a subnode is a directory<commit_after><?php

    require_once 'Sabre/DAV/FS/Node.php';
    require_once 'Sabre/DAV/IDirectory.php';
    require_once 'Sabre/DAV/FS/File.php';

    /**
     * Directory class 
     * 
     * @package Sabre
     * @subpackage DAV
     * @version $Id$
     * @copyright Copyright (C) 2007, 2008 Rooftop Solutions. All rights reserved.
     * @author <NAME> (http://www.rooftopsolutions.nl/) 
     * @license licence http://www.freebsd.org/copyright/license.html  BSD License (4 Clause)
     */
    class Sabre_DAV_FS_Directory extends Sabre_DAV_FS_Node implements Sabre_DAV_IDirectory {

        /**
         * Creates a new file in the directory 
         * 
         * @param string $name Name of the file 
         * @param string $data Initial payload 
         * @return void
         */
        public function createFile($name, $data = null) {

            $newPath = $this->path . '/' . $name;
            file_put_contents($newPath,$data);

        }

        /**
         * Creates a new subdirectory 
         * 
         * @param string $name 
         * @return void
         */
        public function createDirectory($name) {

            $newPath = $this->path . '/' . $name;
            mkdir($newPath);

        }

        /**
         * Returns a specific child node, referenced by its name 
         * 
         * @param string $name 
         * @throws Sabre_DAV_FileNotFoundException
         * @return Sabre_DAV_INode 
         */
        public function getChild($name) {

            $path = $this->path . '/' . $name;

            if (!file_exists($path)) throw new Sabre_DAV_FileNotFoundException('File could not be located');

            if (is_dir($path)) {

                return new Sabre_DAV_FS_Directory($path);

            } else {

                return new Sabre_DAV_FS_File($path);

            }

        }

        /**
         * Returns an array with all the child nodes 
         * 
         * @return Sabre_DAV_INode[] 
         */
        public function getChildren() {

            $nodes = array();
            foreach(scandir($this->path) as $node) if($node!='.' && $node!='..') $nodes[] = $this->getChild($node);
            return $nodes;

        }

    }

?>
{'fraction_non_alphanumeric': 0.11587485515643106, 'fraction_numerical': 0.004171494785631518, 'mean_word_length': 1.620522161505768, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4522223', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1217, 'n_words': 303}