public function getFiles($regex = null, $recursive = false)
    {
        //argument test
        Argument::i()
            //argument 1 must be a string
            ->test(1, 'string', 'null')
            //argument 2 must be a boolean
            ->test(2, 'bool');

        $this->absolute();

        $files = array();

        if ($handle = opendir($this->data)) {
            //for each file
            while (false !== ($file = readdir($handle))) {
                // If this is infact a file
                if (filetype($this->data . '/' . $file) == 'file'
                    && (!$regex || preg_match($regex, $file))) {
                    //add it
                    $files[] = File::i($this->data . '/' . $file);
                // recursive and this is infact a directory
                } else if ($recursive && $file != '.' && $file != '..'
                    && filetype($this->data .'/'. $file) == 'dir') {
                    $subfiles = self::i($this->data.'/'.$file);
                    $files = array_merge($files, $subfiles->getFiles($regex, $recursive));
                }
            }

            closedir($handle);
        }

        return $files;
    }