Sorry if this is a newbie question. I'm just getting used to PHP's Reflection API, and framework-independent namespacing.
I have this code:
<?php # Script 3.4 - index.php
require_once __DIR__.'/vendor/autoload.php';
use App\ApptEncoder;
use App\BloggsApptEncoder;
use App\MegaApptEncoder;
$userDefinedClasses = array_filter(
    get_declared_classes(),
    function($className) {
        return call_user_func(
            array(new ReflectionClass($className), 'isUserDefined')
        );
    }
);
echo('<pre>' . var_dump($userDefinedClasses) . '</pre>');
Later in the script I do call ApptEncoder, BloggsApptEncoder, and MegaApptEncoder, and they do work. However in this var_dump, they don't show. All it shows is:
/home/vagrant/code/ullman/index.php:20:
array (size=2)
  174 => string 'ComposerAutoloaderInit9447e6ccfd181a47ff4686960bd95f38' (length=54)
  175 => string 'Composer\Autoload\ClassLoader' (length=29)
Aucun commentaire:
Enregistrer un commentaire