Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
<?php
class ExamplesController extends AppController {
public $fileCounts = array( );
public function countFilesByExtension( $fileExtension, $directoryPath ){
return $this->setFileCounts( $fileExtension, count( glob( "{$directory}*.{$fileExtension}" )));
}
public function setFileCounts( $key, $value = null ){
$this->fileCounts[ $key ] = $value;
}
public function generateFileCounts( array $fileExtensions, $directoryPath ){
foreach( $fileExtensions as $fileExtension ){
$this->countFilesByExtension( $fileExtension, $directoryPath );
}
}
public function index( ){
$extensions = array( 'jpg', 'gif', 'png' );
$this->generateFileCounts( $extensions, "../images/team/harry/" );
debug( $this->fileCounts );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.