Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
File_Handler_Directory issues (and solutions)
  • I've been using the File_Handler_Directory class for some work and have run into a few issues. I'd put together a pull request but I want to make sure I understand the issue first. 1. The third parameter of the constructor needs to have a null default value (the forge() already has this) in order to use the
    File_Handler_Directory::forge('path/to/dir');
    
    without receiving
    ErrorException [ 4096 ]: Argument 3 passed to Fuel\Core\File_Handler_Directory::__construct() must be an instance of Fuel\Core\File_Area, null given.
    2. Then, if this third parameter's value for is passed in as null, $this->area is also set to null, which causes problems when $this->area is used later in the class with $this->area->rename_dir($var), $this->area->copy_dir($var), etc. I fixed this with:
    $this->area = ! is_null($area) ? $area : \File_Area::forge();
    

    but I didn't know if it should be passing in the $config array from the constructor
    $this->area = ! is_null($area) ? $area : \File_Area::forge($config);
    

    3. The class's (array) $content variable is protected, with no way that I can tell of accessing it from outside the class. I'm currently reading a directory, then looking to loop through the result File_Handler_(File|Directory) objects contained in the $this->content and do something with each of them. Shouldn't there be a getter method for this (magic or otherwise), or should $this->content be public? Thanks.
  • Check out my answer to your other post which is a follow up to this one and should have been in the same topic. Closing this one now.
This discussion has been closed.
All Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion