Skip to content

Instantly share code, notes, and snippets.

@unicodeveloper
Created October 1, 2015 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unicodeveloper/4daef4fe9a6db24ff457 to your computer and use it in GitHub Desktop.
Save unicodeveloper/4daef4fe9a6db24ff457 to your computer and use it in GitHub Desktop.
<?php
namespace Busayo;
class MagicConstants
{
public function getFile()
{
return __FILE__;
}
public function getDirectory()
{
return __DIR__;
}
public function getTrait()
{
return __TRAIT__;
}
public function getNamespace()
{
return __NAMESPACE__;
}
public function getLine()
{
return __LINE__;
}
public function getMethod()
{
return __METHOD__;
}
public function getClass()
{
return __CLASS__;
}
public function getFunction()
{
return __FUNCTION__;
}
}
$app = new MagicConstants;
echo $app->getFile(). PHP_EOL;
echo $app->getDirectory(). PHP_EOL;
echo $app->getTrait(). PHP_EOL;
echo $app->getNamespace(). PHP_EOL;
echo $app->getLine(). PHP_EOL;
echo $app->getMethod(). PHP_EOL;
echo $app->getClass(). PHP_EOL;
echo $app->getFunction(). PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment