PHP 클래스 Jamm\Autoload\Autoloader

A fully-qualified namespace and class must have the following structure \\(\)* Each namespace must have a top-level namespace ("Vendor Name"). Each namespace can have as many sub-namespaces as it wishes. Each namespace separator is converted to DIRECTORY_SEPARATOR when loading from the file system. Each "_" character in the CLASS NAME is converted to DIRECTORY_SEPARATOR. The "_" character has no special meaning in the namespace. The fully-qualified namespace and class is suffixed with ".php" when loading from the file system. Alphabetic characters in vendor names, namespaces, and class names may be of any combination of lower case and upper case. Default place of "vendors" folder is __DIR__.'/../../' directory, you can change it: use set_modules_dir() method Classes of all packages (libraries), placed in the "vendors" folder, will be autoloaded automatically (in first use). You can map namespace of package, placed in any folder: use register_namespace_dir() method. You can map any class also: use register_class() method. In case of errors E_USER_WARNING will be triggered Methods of this class doesn't throws exceptions
저자: OZ ([email protected])
파일 보기 프로젝트 열기: jamm/memory

보호된 프로퍼티들

프로퍼티 타입 설명
$classes
$functions
$modules_dir
$namespaces_dirs
$search_log
$warn_about_not_found

공개 메소드들

메소드 설명
__construct ( boolean $autostart = true )
autoload ( string $class_name ) : boolean
get_modules_dir ( ) : string Return modules dir like "/home/dir/modules" By default will be taken directory of this file without two last folders (__DIR__.'/.
get_namespaces ( )
get_search_log ( )
register_class ( string $class_name, string $path ) : boolean Register class - associate name of the class with path to the file (mapping)
register_namespace_dir ( string $namespace, string $dir ) Associate namespace with directory For example, if namespace '\name\space' will be associated with directory '/home/name/space', class '\name\space\subnamespace\Class_Name.php' will be looked in /home/name/space/subnamespace/Class_Name.php
set_modules_dir ( string $dir ) : void Set directory of modules ("vendors")
set_warn_about_not_found ( $warn_about_not_found = true )
start ( ) start autoloader (register in spl_autoload)

보호된 메소드들

메소드 설명
define_home_dir_constant ( ) Define HOME_DIR - by this constant other modules can check, if autoloader is exists
generate_filepath ( $dir, $class_path )
include_class_file ( $class_name, $file )
log_search_variant ( string $method_title, string $class_name, string $filepath = '' ) Add next variant of filepath from searching method to the log

비공개 메소드들

메소드 설명
find_in_classes ( string $class_name ) : boolean Find classname in registered classes
find_in_namespaces ( string $class ) : boolean | string Find path to the file of class in registered namespaces (root namespace is registered automatically)
lookFileInNamespaceDir ( $class_namespace, $mapped_namespace, $class_name, $mapped_dir )
register_root_namespace ( ) : void Register "vendors" directory as root namespace
warning_class_not_found ( $class_name )

메소드 상세

__construct() 공개 메소드

public __construct ( boolean $autostart = true )
$autostart boolean - call method start in constructor

autoload() 공개 메소드

public autoload ( string $class_name ) : boolean
$class_name string
리턴 boolean

define_home_dir_constant() 보호된 메소드

Define HOME_DIR - by this constant other modules can check, if autoloader is exists
protected define_home_dir_constant ( )

generate_filepath() 보호된 메소드

protected generate_filepath ( $dir, $class_path )

get_modules_dir() 공개 메소드

./../')
public get_modules_dir ( ) : string
리턴 string

get_namespaces() 공개 메소드

public get_namespaces ( )

get_search_log() 공개 메소드

public get_search_log ( )

include_class_file() 보호된 메소드

protected include_class_file ( $class_name, $file )

log_search_variant() 보호된 메소드

Add next variant of filepath from searching method to the log
protected log_search_variant ( string $method_title, string $class_name, string $filepath = '' )
$method_title string
$class_name string
$filepath string

register_class() 공개 메소드

Register class - associate name of the class with path to the file (mapping)
public register_class ( string $class_name, string $path ) : boolean
$class_name string
$path string
리턴 boolean

register_namespace_dir() 공개 메소드

Associate namespace with directory For example, if namespace '\name\space' will be associated with directory '/home/name/space', class '\name\space\subnamespace\Class_Name.php' will be looked in /home/name/space/subnamespace/Class_Name.php
public register_namespace_dir ( string $namespace, string $dir )
$namespace string name\space\ (last symbol - slash, and no slashes in start)
$dir string

set_modules_dir() 공개 메소드

Set directory of modules ("vendors")
public set_modules_dir ( string $dir ) : void
$dir string
리턴 void

set_warn_about_not_found() 공개 메소드

public set_warn_about_not_found ( $warn_about_not_found = true )

start() 공개 메소드

start autoloader (register in spl_autoload)
public start ( )

프로퍼티 상세

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

protected $classes

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

protected $functions

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

protected $modules_dir

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

protected $namespaces_dirs

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

protected $search_log

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

protected $warn_about_not_found