public function checkDirectory($dir, $validationSpec)
    {
        $exists    = file_exists($dir);
        $writable  = $exists && is_writable($dir);
        $missing   = !$exists;
        $creatable = $missing && is_writable(dirname($dir));

        $return = array(
            'exists'    => $exists,
            'writable'  => $writable,
            'missing'   => $missing,
            'creatable' => $creatable
        );

        $return['valid'] = $this->validateDirectory($return, $validationSpec);

        return $return;
    }