本文整理汇总了PHP中ReflectionObject::getFilename方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionObject::getFilename方法的具体用法?PHP ReflectionObject::getFilename怎么用?PHP ReflectionObject::getFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReflectionObject
的用法示例。
在下文中一共展示了ReflectionObject::getFilename方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateKernel
/**
* {@inheritDoc}
* Add the new bundle to the BundleBundle loader infrastructure instead of main kernel
*
* @param QuestionHelper $questionHelper dialog
* @param InputInterface $input input
* @param OutputInterface $output output
* @param KernelInterface $kernel kernel
* @param string $namespace namespace
* @param string $bundle bundle
*
* @return string[]
*/
protected function updateKernel(QuestionHelper $questionHelper, InputInterface $input, OutputInterface $output, KernelInterface $kernel, $namespace, $bundle)
{
// skip if kernel manipulation disabled by options (defaults to true)
$doUpdate = $input->getOption('doUpdateKernel');
if ($doUpdate == 'false') {
return;
}
$auto = true;
if ($input->isInteractive()) {
$auto = $questionHelper->doAsk($output, $questionHelper->getQuestion('Confirm automatic update of your core bundle', 'yes', '?'));
}
$output->write('Enabling the bundle inside the core bundle: ');
$coreBundle = $kernel->getBundle($input->getOption('loaderBundleName'));
if (!is_a($coreBundle, '\\Graviton\\BundleBundle\\GravitonBundleInterface')) {
throw new \LogicException('GravitonCoreBundle does not implement GravitonBundleInterface');
}
$manip = new BundleBundleManipulator($coreBundle);
try {
$ret = $auto ? $manip->addBundle($namespace . '\\' . $bundle) : false;
if (!$ret) {
$reflected = new \ReflectionObject($kernel);
return array(sprintf('- Edit <comment>%s</comment>', $reflected->getFilename()), ' and add the following bundle in the <comment>GravitonCoreBundle::getBundles()</comment> method:', '', sprintf(' <comment>new %s(),</comment>', $namespace . '\\' . $bundle), '');
}
} catch (\RuntimeException $e) {
return array(sprintf('Bundle <comment>%s</comment> is already defined in <comment>%s)</comment>.', $namespace . '\\' . $bundle, 'sGravitonCoreBundle::getBundles()'), '');
}
}
示例2: registersShutdownFunction
private function registersShutdownFunction(\ReflectionObject $object)
{
$fp = fopen($object->getFilename(), 'rb');
while (!feof($fp)) {
if (false !== stripos(fread($fp, 4096), 'register_shutdown_function(')) {
return true;
}
}
fclose($fp);
}
示例3: updateKernel
protected function updateKernel(OutputInterface $output, KernelInterface $kernel, Bundle $bundle)
{
$kernelManipulator = new KernelManipulator($kernel);
$output->write(sprintf('> Enabling the bundle inside <info>%s</info>: ', $this->makePathRelative($kernelManipulator->getFilename())));
try {
$ret = $kernelManipulator->addBundle($bundle->getBundleClassName());
if (!$ret) {
$reflected = new \ReflectionObject($kernel);
return array(sprintf('- Edit <comment>%s</comment>', $reflected->getFilename()), ' and add the following bundle in the <comment>AppKernel::registerBundles()</comment> method:', '', sprintf(' <comment>new %s(),</comment>', $bundle->getBundleClassName()), '');
}
} catch (\RuntimeException $e) {
return array(sprintf('Bundle <comment>%s</comment> is already defined in <comment>AppKernel::registerBundles()</comment>.', $bundle->getBundleClassName()), '');
}
}
示例4: ReflectionObject
function __construct()
{
//check we are using php 5
$this->check_php_version('5.0.0');
//use reflection to get the filename of the subclass that is inheriting from WP_PluginBase
$reflector = new ReflectionObject($this);
$this->plugin_file = $reflector->getFilename();
$this->plugin_dir = dirname($this->plugin_file) . '/';
$this->plugin_dir_name = plugin_basename($this->plugin_dir);
$this->plugin_url = trailingslashit(plugins_url('', $this->plugin_file));
//load any plugin base deps
$this->load_dependancies();
//get the plugin name from the filename. we assume the name of the plugin is the same as the file
$this->init();
}
示例5: updateKernel
protected function updateKernel(InputInterface $input, OutputInterface $output, KernelInterface $kernel, $bundle)
{
$manip = new KernelManipulator($kernel);
try {
$ret = $manip->addBundle($bundle);
if (!$ret) {
$reflected = new \ReflectionObject($kernel);
$output->writeln(sprintf('- Edit <comment>%s</comment>', $reflected->getFilename()));
$output->writeln(" and add the following bundle in the <comment>AppKernel::registerBundles()</comment> method:\n");
$output->writeln(sprintf(" <comment>new %s(),</comment>\n", $bundle));
}
} catch (\RuntimeException $e) {
$output->writeln(sprintf('Bundle <comment>%s</comment> is already defined in <comment>AppKernel::registerBundles()</comment>.', $bundle));
throw $e;
}
}
示例6: loadConfigurationFile
private function loadConfigurationFile()
{
$object = new \ReflectionObject($this);
$classFilename = $object->getFilename();
$parentFolder = dirname($classFilename);
do {
if (file_exists($parentFolder . '/bootstrap.php')) {
require_once $parentFolder . '/bootstrap.php';
break;
}
$scannedFolder = $parentFolder;
$parentFolder = dirname($scannedFolder);
} while ($scannedFolder !== $parentFolder);
if (!function_exists('get_db_params')) {
$this->fail('You have to create the file bootstrap.php in tests/ and define the function "get_db_params"');
}
if (!function_exists('get_model_paths')) {
$this->fail('You have to create the file bootstrap.php in tests/ and define the function "get_model_paths"');
}
}
示例7: init
/**
* Initialize the object
*
* @param BaseScriptClass $pObj A reference to the parent (calling) object
* @param array $conf The configuration set for this module - from global array TBE_MODULES_EXT
* @throws \RuntimeException
* @see \TYPO3\CMS\Backend\Module\BaseScriptClass::checkExtObj()
*/
public function init(&$pObj, $conf)
{
$this->pObj = $pObj;
// Path of this script:
$reflector = new \ReflectionObject($this);
$this->thisPath = dirname($reflector->getFilename());
if (!@is_dir($this->thisPath)) {
throw new \RuntimeException('TYPO3 Fatal Error: Could not find path for class ' . get_class($this), 1381164687);
}
// Local lang:
$this->incLocalLang();
// Setting MOD_MENU items as we need them for logging:
$this->pObj->MOD_MENU = array_merge($this->pObj->MOD_MENU, $this->modMenu());
}
示例8: cms_module_path
/**
* @author go frendi
*
* @param string module_name
*
* @return string
* @desc get module_path (folder name) of specified module_name (name space)
*/
public function cms_module_path($module_name = null)
{
// hack module path by changing the session, don't forget to unset !!!
$module_path = '';
if ($module_name === null) {
if ($this->__controller_module_path != null) {
// no_cms_model and no_cms_autoupdate_model is called by instance controller
// thus the position might not be represent the current module path
// in this case we need data from controller
$module_path = $this->__controller_module_path;
} else {
$reflector = new ReflectionObject($this);
$file_name = $reflector->getFilename();
if (strpos($file_name, FCPATH . 'modules') === 0) {
$file_name = trim(str_replace(FCPATH . 'modules', '', $file_name), DIRECTORY_SEPARATOR);
$file_name_part = explode(DIRECTORY_SEPARATOR, $file_name);
if (count($file_name_part) >= 2) {
$module_path = $file_name_part[0];
}
}
}
} else {
if (!self::$__cms_model_properties['is_module_path_cached']) {
$this->cms_adjust_module();
}
if (array_key_exists($module_name, self::$__cms_model_properties['module_path'])) {
$module_path = self::$__cms_model_properties['module_path'][$module_name];
}
}
return $module_path;
}
示例9: updateKernel
protected function updateKernel(QuestionHelper $questionHelper, InputInterface $input, OutputInterface $output, KernelInterface $kernel, $namespace, $bundle)
{
$auto = true;
if ($input->isInteractive()) {
$auto = $questionHelper->askConfirmation($output, $questionHelper->getQuestion('Confirm automatic update of your Kernel', 'yes', '?'), true);
}
$output->write('Enabling the bundle inside the Kernel: ');
$manip = new KernelManipulator($kernel);
try {
$ret = $auto ? $manip->addBundle($namespace . '\\' . $bundle) : false;
if (!$ret) {
$reflected = new \ReflectionObject($kernel);
return array(sprintf('- Edit <comment>%s</comment>', $reflected->getFilename()), ' and add the following bundle in the <comment>AppKernel::registerBundles()</comment> method:', '', sprintf(' <comment>new %s(),</comment>', $namespace . '\\' . $bundle), '');
}
} catch (\RuntimeException $e) {
return array(sprintf('Bundle <comment>%s</comment> is already defined in <comment>AppKernel::registerBundles()</comment>.', $namespace . '\\' . $bundle), '');
}
}
示例10: cms_module_path
/**
* @author goFrendiAsgard
* @param string module_name
* @return string
* @desc get module_path (folder name) of specified module_name (name space)
*/
protected function cms_module_path($module_name = NULL)
{
if ($module_name === NULL) {
$module_path = '';
$reflector = new ReflectionObject($this);
$file_name = $reflector->getFilename();
if (strpos($file_name, FCPATH . 'modules') === 0) {
$file_name = trim(str_replace(FCPATH . 'modules', '', $file_name), DIRECTORY_SEPARATOR);
$file_name_part = explode(DIRECTORY_SEPARATOR, $file_name);
if (count($file_name_part) >= 2) {
$module_path = $file_name_part[0];
}
}
return $module_path;
} else {
return $this->{$this->__cms_base_model_name}->cms_module_path($module_name);
}
}
示例11: updateKernel
private function updateKernel(OutputInterface $output, KernelInterface $kernel, $namespace, $bundle)
{
$output->write('Enabling the bundle inside the Kernel: ');
$kernel = new KernelManipulator($kernel);
if (!$kernel->addBundle($namespace . '\\' . $bundle)) {
$reflected = new \ReflectionObject($kernel);
return array(sprintf('- Edit <comment>%s</comment>', $reflected->getFilename()), ' and add the following bundle in the <comment>AppKernel::registerBundles()</comment> method:', '', sprintf(' <comment>new %s(),</comment>', $namespace . '\\' . $bundle), '');
}
}
示例12: getClassViewFilePath
/**
* @param string $file
* @return string string
*/
protected function getClassViewFilePath($file)
{
$object = new \ReflectionObject($this);
$file = dirname($object->getFilename()) . DIRECTORY_SEPARATOR . \Uc::app()->theme->getViewsDir() . DIRECTORY_SEPARATOR . trim($file, DIRECTORY_SEPARATOR) . \Uc::app()->theme->getTemplateExtension();
return $file;
}
示例13: testAddFilesMap
public function testAddFilesMap()
{
$this->assertFalse(class_exists('Test_Magento_Autoload_Map', false));
$this->_loader->addFilesMap(array('Test_Magento_Autoload_Map' => 'dev/tests/unit/testsuite/Magento/Autoload/TestMap.php'));
$reflection = new ReflectionObject(new Test_Magento_Autoload_Map());
$this->assertStringEndsWith('TestMap.php', $reflection->getFilename());
$this->assertFalse(class_exists('Unit_TestClassMapClass', false));
$this->_loader->addFilesMap(__DIR__ . '/Autoload/classmap.ser');
$reflection = new ReflectionObject(new Unit_TestClassMapClass());
$this->assertStringEndsWith('TestClassMapInFile.php', $reflection->getFilename());
}
示例14: updateKernel
private function updateKernel($dialog, InputInterface $input, OutputInterface $output, KernelInterface $kernel, $namespace, $bundle)
{
$auto = true;
if ($input->isInteractive()) {
$auto = $dialog->askConfirmation($output, $this->getQuestion('Confirm automatic update of your Kernel', 'yes', '?'), true);
}
$output->write('Enabling the bundle inside the Kernel: ');
$manip = new KernelManipulator($kernel);
$ret = $auto ? $manip->addBundle($namespace . '\\' . $bundle) : false;
if (!$ret) {
$reflected = new \ReflectionObject($kernel);
return array(sprintf('- Edit <comment>%s</comment>', $reflected->getFilename()), ' and add the following bundle in the <comment>AppKernel::registerBundles()</comment> method:', '', sprintf(' <comment>new %s(),</comment>', $namespace . '\\' . $bundle), '');
}
}
示例15: updateKernel
protected function updateKernel($dialog, InputInterface $input, OutputInterface $output, KernelInterface $kernel, $namespace, $bundle)
{
$output->writeln('Enabling the bundle inside the Kernel');
$manip = new KernelManipulator($kernel);
try {
if (!$manip->addBundle($namespace)) {
$reflected = new \ReflectionObject($kernel);
return array(sprintf('- Edit <comment>%s</comment>', $reflected->getFilename()), ' and add the following bundle in the <comment>AppKernel::registerBundles()</comment> method:', '', sprintf(' <comment>new %s(),</comment>', $namespace), '');
}
} catch (\RuntimeException $e) {
return array(sprintf('Bundle <comment>%s</comment> is already defined in <comment>AppKernel::registerBundles()</comment>.', $namespace), '');
}
}