Loading array of themes I am currently writing a simple PHP script that uses themes and I found myself writing these methods as part of a class that handles theme config files:

public function getArrayOfThemeNames()
{
    $this-&gt;loadUnfilteredDirectoryListing();
    $this-&gt;loadThemeFiles();
    return $this-&gt;theme_files;
}

private function loadUnfilteredDirectoryListing()
{
    $this-&gt;unfiltered_dir_listing = scandir($this-&gt;theme_config_directory);
}

private function loadThemeFiles()
{
    foreach($this-&gt;unfiltered_dir_listing as $file)
    {
        if($file != ".." and $file != ".")
            $this-&gt;theme_files[] = $file;
    }
}


Does the getArrayOfThemeNames() method violate SRP, as it could be argued it does two (or potentially even three)?  It loads the theme files array and then returns it.

Am I over-thinking this or should this be split into two methods -- one that fills the themes array, and another that returns it?
Well, the function kind-of sort-of violates SRP...but according to Uncle Bob, I think your class violates the SRP moreso than the function. 

Your class above, has three functions within it: getArrayOfThemeNames(), loadUnfilteredDirectoryListing(), and loadThemeFiles(). One of them scans the directory, one of theme creates an array of theme names, and another loads the theme files. One of those methods should not be in there: loadUnfilteredDirectoryListing should be in its own class called DirectoryLister{} or something. Which means, by extension, that getArrayOfThemeNames() is in violation of SRP. To quote Atwood - SRP is about "choosing a single, clearly defined goal for any particular bit of code: Do One Thing ... But in choosing one thing, you are ruling out an infinite universe of other possible things you could have done. It also means consciously choosing what your code won't do.". So in the end, its up to you whether this violates SRP and whether you would choose to follow SRP so deeply that you violate OOP or DRY. 

Perhaps someone with more experience can chime in or prove me wrong (heck, always good to learn something from someone else)

EDIT: See (http://www.oodesign.com/single-responsibility-principle.html) article as well for clarification. 

REVISIT 01/26/2015: Revisiting this answer, I would rewrite the code as follows:

class Theme {
    public $theme_directory;
    public $theme_files;

    public function __construct($theme_directory){
        $this-&gt;theme_directory = $theme_directory;
    }

    public function get_theme_names() /* Array */ {
        $this-&gt;load_theme_files();
        return $this-&gt;theme_files;
    }

    private function load_theme_files(Directory $directory) /* Null */ {
        $directory-&gt;directory = $this-&gt;theme_directory;
        foreach($directory-&gt;load_unfiltered() as $file) {
            if($file != '..' &amp;&amp; $file != '.') {
                $this-&gt;theme_files[] = $file;
            }
        }
    }
}

class Directory {
    public $directory;

    public function __construct() {
        $this-&gt;directory = $directory;
    }

    private function load_unfiltered() /* array */ {
        return  scandir($this-&gt;directory);
    }
}