public static function getAllWebsites() { if (is_null(self::$allWebsites) || !is_array(self::$allWebsites)) { self::$allWebsites = array(); QueryBuilder::create(SQL::getConnection())->withQuery("SELECT id, display_name, folder_name FROM websites")->build()->forEachResult(function ($row) { self::$allWebsites[] = new Website($row['id'], $row['display_name'], $row['folder_name']); }); if (count(self::$allWebsites) == 0) { throw new Exception("You suck."); } } return self::$allWebsites; }