PHP 클래스 PHPExiftool\Reader

It scans files and directories, and provide an iterator on the FileEntities generated based on the results. Example usage: $Reader = new Reader(); $Reader->in('/path/to/directory') ->exclude('tests') ->extensions(array('jpg', 'xml)); Throws an exception if no file found $first = $Reader->first(); Returns null if no file found $first = $Reader->getOneOrNull(); foreach($Reader as $entity) { Do your logic with FileEntity }
저자: Romain Neutron ([email protected])
상속: implements IteratorAggregate
파일 보기 프로젝트 열기: romainneutron/PHPExiftool 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$collection Doctrine\Common\Collections\ArrayCollection
$dirs
$excludeDirs
$exiftool
$extensions
$extensionsToggle
$files
$followSymLinks
$ignoreDotFile
$parser
$readers
$recursive
$sort

공개 메소드들

메소드 설명
__construct ( Exiftool $exiftool, RDFParser $parser ) Constructor
__destruct ( )
all ( ) : ArrayCollection Perform the scan and returns all the results
append ( Reader $reader ) : Reader Append a reader to this one.
create ( Psr\Log\LoggerInterface $logger )
exclude ( string | array $dirs ) : Reader Exclude directories from scan
extensions ( string | array $extensions, boolean $restrict = true ) : Reader Restrict / Discard files based on extensions Extensions are case insensitive
files ( string | array $files ) : Reader Add files to scan
first ( ) : FileEntity Return the first result. If no result available, throws an exception
followSymLinks ( ) : Reader Toggle to enable follow Symbolic Links
getIterator ( ) : Iterator Implements \IteratorAggregate Interface
getOneOrNull ( ) : FileEntity Return the first result. If no result available, null is returned
ignoreDotFiles ( ) : Reader Ignore files starting with a dot (.)
in ( string | array $dirs ) : Reader Add dirs to scan
notRecursive ( ) : Reader Disable recursivity in directories scan.
reset ( )
sort ( string | array $by ) : Reader Sort results with one or many criteria

보호된 메소드들

메소드 설명
buildQuery ( ) : string Build query from criterias
buildQueryAndExecute ( ) : ArrayCollection Build the command returns an ArrayCollection of FileEntity
computeExcludeDirs ( string $rawExcludeDirs, $rawSearchDirs ) : array Compute raw exclude rules to simple ones, based on exclude dirs and search dirs
resetResults ( ) : Reader Reset any computed result

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( Exiftool $exiftool, RDFParser $parser )
$exiftool Exiftool
$parser RDFParser

__destruct() 공개 메소드

public __destruct ( )

all() 공개 메소드

Perform the scan and returns all the results
public all ( ) : ArrayCollection
리턴 Doctrine\Common\Collections\ArrayCollection

append() 공개 메소드

Finale result will be the sum of the current reader and all appended ones.
public append ( Reader $reader ) : Reader
$reader Reader The reader to append
리턴 Reader

buildQuery() 보호된 메소드

Build query from criterias
protected buildQuery ( ) : string
리턴 string

buildQueryAndExecute() 보호된 메소드

Build the command returns an ArrayCollection of FileEntity
protected buildQueryAndExecute ( ) : ArrayCollection
리턴 Doctrine\Common\Collections\ArrayCollection

computeExcludeDirs() 보호된 메소드

Compute raw exclude rules to simple ones, based on exclude dirs and search dirs
protected computeExcludeDirs ( string $rawExcludeDirs, $rawSearchDirs ) : array
$rawExcludeDirs string
리턴 array

create() 공개 정적인 메소드

public static create ( Psr\Log\LoggerInterface $logger )
$logger Psr\Log\LoggerInterface

exclude() 공개 메소드

Warning: only first depth directories can be excluded Imagine a directory structure like below, With a scan in "root", only sub1 or sub2 can be excluded, not subsub. root ├── sub1 └── sub2    └── subsub Example usage: Will scan documents recursively, discarding documents/test $Reader ->in('documents') ->exclude(array('test'))
public exclude ( string | array $dirs ) : Reader
$dirs string | array The directories
리턴 Reader

extensions() 공개 메소드

Restrict / Discard files based on extensions Extensions are case insensitive
public extensions ( string | array $extensions, boolean $restrict = true ) : Reader
$extensions string | array The list of extension
$restrict boolean Toggle restrict/discard method
리턴 Reader

files() 공개 메소드

Example usage: Will scan 3 files : dc00.jpg in CWD and absolute paths /tmp/image.jpg and /tmp/raw.CR2 $Reader ->files('dc00.jpg') ->files(array('/tmp/image.jpg', '/tmp/raw.CR2'))
public files ( string | array $files ) : Reader
$files string | array The files
리턴 Reader

first() 공개 메소드

Return the first result. If no result available, throws an exception
public first ( ) : FileEntity
리턴 FileEntity

getIterator() 공개 메소드

Implements \IteratorAggregate Interface
public getIterator ( ) : Iterator
리턴 Iterator

getOneOrNull() 공개 메소드

Return the first result. If no result available, null is returned
public getOneOrNull ( ) : FileEntity
리턴 FileEntity

ignoreDotFiles() 공개 메소드

Folders starting with a dot are always exluded due to exiftool behaviour. You should include them manually
public ignoreDotFiles ( ) : Reader
리턴 Reader

in() 공개 메소드

Example usage: Will scan 3 dirs : documents in CWD and absolute paths /usr and /var $Reader ->in('documents') ->in(array('/tmp', '/var'))
public in ( string | array $dirs ) : Reader
$dirs string | array The directories
리턴 Reader

notRecursive() 공개 메소드

If you only specify files, this toggle has no effect
public notRecursive ( ) : Reader
리턴 Reader

reset() 공개 메소드

public reset ( )

resetResults() 보호된 메소드

Reset any computed result
protected resetResults ( ) : Reader
리턴 Reader

sort() 공개 메소드

Example usage: Will sort by directory then filename $Reader ->in('documents') ->sort(array('directory', 'filename')) Will sort by filename $Reader ->in('documents') ->sort('filename')
public sort ( string | array $by ) : Reader
$by string | array
리턴 Reader

프로퍼티 상세

$collection 보호되어 있는 프로퍼티

protected ArrayCollection,Doctrine\Common\Collections $collection
리턴 Doctrine\Common\Collections\ArrayCollection

$dirs 보호되어 있는 프로퍼티

protected $dirs

$excludeDirs 보호되어 있는 프로퍼티

protected $excludeDirs

$exiftool 보호되어 있는 프로퍼티

protected $exiftool

$extensions 보호되어 있는 프로퍼티

protected $extensions

$extensionsToggle 보호되어 있는 프로퍼티

protected $extensionsToggle

$files 보호되어 있는 프로퍼티

protected $files

$ignoreDotFile 보호되어 있는 프로퍼티

protected $ignoreDotFile

$parser 보호되어 있는 프로퍼티

protected $parser

$readers 보호되어 있는 프로퍼티

protected $readers

$recursive 보호되어 있는 프로퍼티

protected $recursive

$sort 보호되어 있는 프로퍼티

protected $sort