Phpxforms documentation

Autoloader
in package

Simple autoloader PHP 7.1+

basic usage: new Autoloader("/path/to/temp.json", ["./directory/"=>true], ["./directory/dont-index/"=>true]); or: new Autoloader(null, ["./directory/"=>false]);

Tags
author

DaVee8k

license

Lesser General Public License 2.1 or later; see http://www.gnu.org/licenses/lgpl-2.1.html

version
0.87dev

Table of Contents

Properties

$extRegex  : string
$ignoreDuplicates  : bool
$ignoreItems  : array<string|int, string>
$markDir  : string
$onlyNamespace  : bool
$classList  : array<string, string>
$dirs  : array<string, bool>
$ignore  : array<string, bool>
$tempFile  : string|null
$timeMark  : int|false

Methods

__construct()  : mixed
Create class index and register load function
load()  : void
Load file with required class
checkPath()  : void
Check if files were indexed in current directory
findFiles()  : void
Search for source files
getContentClasses()  : array<string|int, array<string, string>>
Find classes in source file
isTryReindex()  : bool
Timeout for reindexing
loadFileClasses()  : void
Put found classes into array and check for duplicity
reindex()  : void
Search in files for classes and optionally creates temp file with array

Properties

$extRegex

public static string $extRegex = '/\\.(php|php5)$/i'

Index files with extensions

$ignoreDuplicates

public static bool $ignoreDuplicates = false

Ignore duplicate classes

$ignoreItems

public static array<string|int, string> $ignoreItems = ['.', '..']

Ignore files when indexing

$markDir

public static string $markDir = '0 DIR'

Special directory name for testing when script are moved to different directory

$onlyNamespace

public static bool $onlyNamespace = false

Allow only classes with namespace

$classList

protected array<string, string> $classList = []

$ignore

protected array<string, bool> $ignore = []

Methods

__construct()

Create class index and register load function

public __construct(string|null $tempFile, array<string, bool> $dirs[, array<string, bool> $ignore = [] ]) : mixed
Parameters
$tempFile : string|null

File for class list cache (can be disabled with null)

$dirs : array<string, bool>

Directories to index

$ignore : array<string, bool> = []

directories to skip

load()

Load file with required class

public load(string $class) : void
Parameters
$class : string

class name

checkPath()

Check if files were indexed in current directory

protected checkPath() : void

findFiles()

Search for source files

protected findFiles(string $dir, bool $searchSubDir) : void
Parameters
$dir : string
$searchSubDir : bool

getContentClasses()

Find classes in source file

protected getContentClasses(string $src) : array<string|int, array<string, string>>
Parameters
$src : string

source code

Return values
array<string|int, array<string, string>>

isTryReindex()

Timeout for reindexing

protected isTryReindex([string|null $class = null ]) : bool
Parameters
$class : string|null = null

class name

Return values
bool

loadFileClasses()

Put found classes into array and check for duplicity

protected loadFileClasses(string $file[, bool $ignore = false ]) : void
Parameters
$file : string
$ignore : bool = false

ignore duplicate classes

Tags
throws
RuntimeException

duplicate exists

reindex()

Search in files for classes and optionally creates temp file with array

protected reindex([bool $replace = true ]) : void
Parameters
$replace : bool = true
Tags
throws
RuntimeException

directory is set instead of settings


        
On this page

Search results