本文整理汇总了PHP中xp::null方法的典型用法代码示例。如果您正苦于以下问题:PHP xp::null方法的具体用法?PHP xp::null怎么用?PHP xp::null使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xp
的用法示例。
在下文中一共展示了xp::null方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __static
static function __static()
{
self::$UNKNOWN = new self(0, 'UNKNOWN', xp::null(), xp::null());
self::$JSON = new self(1, 'JSON', new RestJsonSerializer(), new RestJsonDeserializer());
self::$XML = new self(2, 'XML', new RestXmlSerializer(), new RestXmlDeserializer());
self::$FORM = new self(3, 'FORM', xp::null(), new RestFormDeserializer());
}
示例2: bean
/**
* Retrieve a single bean
*
* @param string name
* @return remote.reflect.BeanDescription or NULL if nothing is found
*/
public function bean($name)
{
if (!isset($this->beans[$name])) {
return xp::null();
}
return $this->beans[$name];
}
示例3: outcomeOf
/**
* Returns the outcome of a specific test
*
* @param unittest.TestCase test
* @return unittest.TestOutcome
*/
public function outcomeOf(TestCase $test)
{
$key = $test->hashCode();
foreach (array($this->succeeded, $this->failed, $this->skipped) as $lookup) {
if (isset($lookup[$key])) {
return $lookup[$key];
}
}
return xp::null();
}
示例4: _read
/**
* Helper method to delegate call
*
* @param string method
* @param string section
* @param string key
* @param mixed default
* @return mixed
*/
private function _read($method, $section, $key, $default)
{
foreach ($this->props as $p) {
$res = call_user_func_array(array($p, $method), array($section, $key, xp::null()));
if (xp::null() !== $res) {
return $res;
}
}
return $default;
}
示例5: xpNullArgument
public function xpNullArgument()
{
$this->assertEquals('<null>', \xp::stringOf(\xp::null()));
}
示例6: null
public function null()
{
$this->assertEquals('null', get_class(xp::null()));
}
示例7: cast
function cast(Generic $expression = NULL, $type)
{
if (NULL === $expression) {
return xp::null();
} else {
if (XPClass::forName($type)->isInstance($expression)) {
return $expression;
}
}
raise('lang.ClassCastException', 'Cannot cast ' . xp::typeOf($expression) . ' to ' . $type);
}
示例8: getProcessById
/**
* Get a process by process ID
*
* @param int pid process id
* @param string exe
* @return lang.Process
* @throws lang.IllegalStateException
*/
public static function getProcessById($pid, $exe = NULL)
{
$self = new self();
$self->status = array('pid' => $pid, 'running' => TRUE, 'exe' => $exe, 'command' => '', 'arguments' => NULL, 'owner' => FALSE);
// Determine executable and command line:
// * On Windows, use Windows Management Instrumentation API - see
// http://en.wikipedia.org/wiki/Windows_Management_Instrumentation
//
// * On systems with a /proc filesystem, use information from /proc/self
// See http://en.wikipedia.org/wiki/Procfs. Before relying on it,
// also check that /proc is not just an empty directory; this assumes
// that process 1 always exists - which usually is `init`.
//
// * Fall back to use the PHP_BINARY (#54514) constant and finally the "_"
// environment variable for the executable and /bin/ps to retrieve the
// command line (please note unfortunately any quote signs have been
// lost and it can thus be only used for display purposes)
if (strncasecmp(PHP_OS, 'Win', 3) === 0) {
try {
$c = new com('winmgmts:');
$p = $c->get('//./root/cimv2:Win32_Process.Handle="' . $pid . '"');
$self->status['exe'] = $p->executablePath;
$self->status['command'] = $p->commandLine;
} catch (Exception $e) {
throw new IllegalStateException('Cannot find executable: ' . $e->getMessage());
}
} else {
if (is_dir('/proc/1')) {
if (!file_exists($proc = '/proc/' . $pid)) {
throw new IllegalStateException('Cannot find executable in /proc');
}
if (defined('PHP_BINARY')) {
$self->status['exe'] = PHP_BINARY;
} else {
do {
foreach (array('/exe', '/file') as $alt) {
if (!file_exists($proc . $alt)) {
continue;
}
$self->status['exe'] = readlink($proc . $alt);
break 2;
}
throw new IllegalStateException('Cannot find executable in ' . $proc);
} while (0);
}
$self->status['command'] = strtr(file_get_contents($proc . '/cmdline'), "", ' ');
} else {
try {
if (defined('PHP_BINARY')) {
$self->status['exe'] = PHP_BINARY;
} else {
if ($exe) {
$self->status['exe'] = self::resolve($exe);
} else {
if ($_ = getenv('_')) {
$self->status['exe'] = self::resolve($_);
} else {
throw new IllegalStateException('Cannot find executable');
}
}
}
$self->status['command'] = exec('ps -ww -p ' . $pid . ' -ocommand 2>&1', $out, $exit);
if (0 !== $exit) {
throw new IllegalStateException('Cannot find executable: ' . implode('', $out));
}
} catch (IOException $e) {
throw new IllegalStateException($e->getMessage());
}
}
}
$self->in = xp::null();
$self->out = xp::null();
$self->err = xp::null();
return $self;
}
示例9: xpNullIsNotAnInstanceOfGeneric
public function xpNullIsNotAnInstanceOfGeneric()
{
$this->assertInstanceOf('lang.Generic', xp::null());
}
示例10: thisClassCastingNull
public function thisClassCastingNull()
{
$this->assertEquals(xp::null(), $this->getClass()->cast(NULL));
}
示例11: createEntry
/**
* Creates a new StorageElement or StorageCollection (depending on
* type)
*
* @param string clientId
* @param string uri
* @param int type
* @return peer.ftp.server.storage.StorageEntry
*/
public function createEntry($clientId, $uri, $type)
{
$path = substr($this->realname($clientId, $uri), strlen($this->root));
switch ($type) {
case ST_ELEMENT:
return new FilesystemStorageElement($path, $this->root);
case ST_COLLECTION:
return new FilesystemStorageCollection($path, $this->root);
}
return xp::null();
}
示例12: xpnullIsnull
public function xpnullIsnull()
{
$this->assertTrue(is(null, \xp::null()));
}
示例13: beginAt
/**
* Navigate to a relative URL
*
* @param string relative
* @param string params
* @throws unittest.AssertionFailedError
*/
public function beginAt($relative, $params = NULL, $method = HttpConstants::GET)
{
$this->dom = $this->xpath = NULL;
$this->conn->getUrl()->setPath($relative);
try {
$this->response = $this->doRequest($method, $params);
// If we get a cookie, store it for this domain and reuse it in
// subsequent requests. If cookies are used for sessioning, we
// would be creating new sessions with every request otherwise!
foreach ((array) $this->response->header('Set-Cookie') as $str) {
$cookie = Cookie::parse($str);
$this->cookies[$this->conn->getUrl()->getHost()][$cookie->getName()] = $cookie;
}
} catch (XPException $e) {
$this->response = xp::null();
$this->fail($relative, $e, NULL);
}
}
示例14: xpNullIsNull
public function xpNullIsNull()
{
$this->assertTrue(is(NULL, xp::null()));
$this->assertFalse(is(NULL, 1));
}
示例15: findResource
/**
* Find the resource by the specified name
*
* @param string name resource name
* @return lang.IClassLoader the classloader that provides this resource
*/
public function findResource($name)
{
foreach (self::$delegates as $delegate) {
if ($delegate->providesResource($name)) {
return $delegate;
}
}
return xp::null();
}