本文整理汇总了PHP中spl_classes函数的典型用法代码示例。如果您正苦于以下问题:PHP spl_classes函数的具体用法?PHP spl_classes怎么用?PHP spl_classes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spl_classes函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getClass
/**
* 获得spl的所有class
*/
function getClass()
{
$spl_classes = spl_classes();
foreach ($spl_classes as $key => $val) {
echo $key . '=>' . $val . '<br />';
}
}
示例2: testCanMockAllSplClasses
function testCanMockAllSplClasses()
{
if (!function_exists('spl_classes')) {
return;
}
foreach (spl_classes() as $class) {
$mock_class = "Mock{$class}";
Mock::generate($class);
$this->assertIsA(new $mock_class(), $mock_class);
}
}
示例3: testCanMockAllSplClasses
public function testCanMockAllSplClasses()
{
static $classesToExclude = ['SplHeap'];
foreach (spl_classes() as $class) {
// exclude classes
if (in_array($class, $classesToExclude)) {
continue;
}
$mock_class = "Mock{$class}";
Mock::generate($class);
$this->assertIsA(new $mock_class(), $mock_class);
}
}
示例4: testCanMockAllSplClasses
function testCanMockAllSplClasses()
{
if (!function_exists('spl_classes')) {
return;
}
foreach (spl_classes() as $class) {
if ($class == 'SplHeap') {
continue;
}
if (version_compare(PHP_VERSION, '5.1', '<') && $class == 'CachingIterator' || $class == 'CachingRecursiveIterator' || $class == 'FilterIterator' || $class == 'LimitIterator' || $class == 'ParentIterator') {
// These iterators require an iterator be passed to them during
// construction in PHP 5.0; there is no way for SimpleTest
// to supply such an iterator, however, so support for it is
// disabled.
continue;
}
$mock_class = "Mock{$class}";
Mock::generate($class);
$this->assertIsA(new $mock_class(), $mock_class);
}
}
示例5: register
public static function register()
{
$autoloads = spl_autoload_functions();
$callback = array(__CLASS__, 'loadClass');
//@codeCoverageIgnoreStart
if (!in_array($callback, $autoloads)) {
spl_autoload_register($callback);
}
if (is_null(self::$splClasses)) {
self::$splClasses = array();
foreach (spl_classes() as $splClass) {
if (false !== strpos($splClass, 'Exception')) {
if (!in_array($splClass, self::$splClasses)) {
self::$splClasses[$splClass] = $splClass;
}
}
}
}
if (is_null(self::$template)) {
self::$template = file_get_contents(__DIR__ . '/resources/exception.tpl', LOCK_EX);
}
//@codeCoverageIgnoreEnd
}
示例6: foreach
<?php
/**
*
* Host php file to Chapter6 classes
*
*/
include_once 'class.directoryiteratorexample.php';
/*---------- Available SPL Objects ----------*/
foreach (spl_classes() as $key => $value) {
echo $value, "<br>";
}
/*---------- DirectoryIterator SPL ----------*/
$run = new DirectoryIteratorExample("/var/www/exercises/public_html/php_exercises/");
$run->getAllDirectoryFiles();
示例7: isPHPInternalClass
/**
* Get a list of PHP defined classes
*
* @param $nameOrObject
* @return bool
*/
public static function isPHPInternalClass($nameOrObject)
{
return in_array(ltrim((string) static::getClass($nameOrObject), '\\'), spl_classes());
}
示例8: foreach
<?php
foreach (spl_classes() as $name) {
echo $name . '<br>';
}
示例9: array_merge
<?php
//-----------------------------------------------------------
// settings
//-----------------------------------------------------------
$base_path = "d:/www/htdocs/zend/";
$source_dir = $base_path . "library/";
$packed_dir = $base_path . "packed/";
$compiled_dir = $base_path;
$compiled_file = $compiled_dir . "zend_framework_min.php";
$ADD_SOURCE_FILE_NAMES = 1;
$pattern_require = "/(require_once[\\s\t]*[\"\\'\\(]+([^\\'\"\\(\\)]+?)[\\'\"\\)]+[\\s\t]*;[\\s\t]*)/ims";
//-----------------------------------------------------------
$GLOBALS['CLASSES'] = [];
$GLOBALS['CLASSES_PATHS'] = [];
$GLOBALS["BUILT_IN_CLASSES"] = array_merge(get_declared_classes(), spl_classes(), get_declared_interfaces());
$GLOBALS["INHERIT_TREE"] = [];
$GLOBALS["INHERIT_CHILDREN"] = [];
$GLOBALS["INHERIT_PARENTS"] = [];
$GLOBALS["INHERIT_TOP"] = [];
$GLOBALS["INHERIT_NONE"] = [];
$GLOBALS["ABSTRACT_CLASSES"] = [];
$GLOBALS["INTERFACES"] = [];
//-----------------------------------------------------------
$time_start = array_sum(explode(" ", microtime()));
//-----------------------------------------------------------
/**
* Put string contents to the file
*/
if (!function_exists("file_put_contents")) {
function file_put_contents($filename, $data)
示例10: var_dump
<?php
/**
* Created by PhpStorm.
* User: USER
* Date: 26/5/2015
* Time: 10:27
*/
var_dump(spl_classes());
示例11: var_dump
<?php
var_dump(is_array(spl_classes()));
示例12: spl_classes
<?php
$classes = spl_classes();
foreach ($classes as $classe) {
$rc = new ReflectionClass($classe);
print $classe . PHP_EOL;
foreach ($rc->getMethods() as $method) {
print ' ' . $method->getName();
print '(';
$paramNames = array();
$parameters = $method->getParameters();
if (count($parameters) > 0) {
foreach ($parameters as $parameter) {
if ($parameter->isOptional()) {
$paramNames[] = '[' . $parameter->getName() . ']';
} else {
$paramNames[] = $parameter->getName();
}
}
}
print implode(', ', $paramNames);
print ')';
print '<br>' . PHP_EOL;
}
}
示例13: print_r
<?php
print_r(spl_classes());