/ Published in: PHP
excursion repo
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php namespace Repositories; /** * ExcursionRepository */ class ExcursionRepository extends BaseRepository { protected $basePath; protected $excursionsPath; public function __construct($wwwDir, $excursionsPath) { $this->basePath = $wwwDir; $this->excursionsPath = $excursionsPath; } /** * get array of files (scandir) * filter out directiries (array_filter) * prepend a full path string (array_map) * filter out photos * * @return array */ public function getAllExcursionPhotos() { $excursionsFullPath = $this->basePath . $this->excursionsPath; } return $photoPaths; } /** * Callback * * @param $itemPath * @return bool */ public function filterOutDirectories($itemPath) { $excursionsFullPath = $this->basePath . $this->excursionsPath; } /** * Callback * * @param $itemPath * @return string */ public function prependExcursionPath($itemPath) { return $this->excursionsPath . $itemPath; } /** * Callback * * @param $itemPath * @return string */ public function filterPhotos($itemPath) { $fullPath = $this->basePath . $itemPath; return parent::isPhoto($fullPath); } }