本文整理汇总了PHP中Core::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::with方法的具体用法?PHP Core::with怎么用?PHP Core::with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::with方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_subclass_of
/**
* Проверяет является ли данный класс данного объект наследником заданного класса
*
* @param $ancestor
* @param $object
*
* @return boolean
*/
public static function is_subclass_of($ancestor, $object)
{
$ancestor_class = self::real_class_name_for($ancestor);
if (is_object($object)) {
return $object instanceof $ancestor_class;
}
$object_class = self::real_class_name_for($object);
if (!class_exists($object_class, false)) {
return false;
}
//return $object_class instanceof $ancestor_class;
//TODO: remove:
$object_reflection = new ReflectionClass($object_class);
return Core::with($ancestor_reflection = new ReflectionClass($ancestor_class))->isInterface() ? $object_reflection->implementsInterface($ancestor_class) : $object_reflection->isSubclassOf($ancestor_reflection);
}
示例2: run
/**
* @param array $argv
*
* @return int
*/
public function run(array $argv)
{
Core::with($this->config->output ? IO_FS::File($this->config->output)->open('w+') : IO::stdout())->write(Dev_Source::Library($argv)->xml->SaveXML());
return 0;
}
示例3: main
/**
* @param array $argv
*/
public static function main(array $argv)
{
Core::with(new Dev_Source_Diagram_Application())->main($argv);
}
示例4: load
/**
* @param boolean $reload
*
* @return Dev_Source_Library
*/
public function load($reload = false)
{
if (!$this->xml || $reload) {
$library = Core::with($this->xml = new DOMDocument())->appendChild(new DOMElement('library'));
foreach ($this->modules as $module) {
if ($module->xml) {
$library->appendChild($this->xml->importNode($module->xml->documentElement, true));
}
}
}
return $this->xml;
}
示例5: next_part
private function next_part()
{
$part = $this->source->valid() ? $this->source->current() : null;
return $part ? $part instanceof Iterator ? $part : ($part instanceof IteratorAggregate ? $part->getIterator() : Core::with(new ArrayObject((array) $part))->getIterator()) : null;
}
示例6: method
/**
* @param string $name
* @param int $http_mask
* @param string $path
* @param string $formats
*
* @return WS_REST_DSL_Resource
*/
public function method($name, $http_mask = Net_HTTP::ANY, $path = null, $formats = null, $defaults = array())
{
$formats = $formats === null ? isset($this->scope->formats) ? $this->scope->formats : array() : $formats;
$path = $path === null ? isset($this->scope->path) ? $this->scope->path : 'index' : $path;
$name = $name ? $name : $path;
$http_mask = $http_mask === null ? isset($this->scope->http_methods) ? $this->scope->http_methods : Net_HTTP::ANY : $http_mask;
$this->object->method(Core::with(new WS_Services_REST_Method($name))->path($path)->http($http_mask)->defaults($defaults)->produces(is_array($formats) ? $formats : Core_Strings::split_by(',', (string) $formats)));
return $this;
}
示例7: start
/**
* @return Dev_Benchmark_Timer
*/
public static function start()
{
return Core::with(new Dev_Benchmark_Timer())->start();
}
示例8: main
/**
* Фабричный метод, возвращает объект приложения
*
* @param array $argv
*/
public static function main(array $argv)
{
Core::with(new Dev_Cache_Dump_Application())->main($argv);
}
示例9: get_properties
private function get_properties()
{
$result = array();
foreach (Core::with(new ReflectionObject($this))->getProperties() as $v) {
if (($name = $v->getName()) != '_frozen') {
$result[] = $v->getName();
}
}
return $result;
}
示例10: run
/**
* @param Dev_Unit_TestResult $result
*
* @return Dev_Unit_TestResult
*/
public function run(Dev_Unit_TestResult $result = null)
{
Core::with($result = Core::if_null($result, Dev_Unit::TestResult()))->start_test($this);
$is_ok = true;
try {
$this->before_setup();
$this->setup();
$this->after_setup();
} catch (Exception $e) {
$result->add_error($this, Dev_Unit_Error::make_from($this, $e));
$is_ok = false;
}
if ($is_ok) {
try {
call_user_func(array($this, $this->method));
} catch (Dev_Unit_FailureException $e) {
$result->add_failure($this, Dev_Unit_Failure::make_from($this, $e));
$is_ok = false;
} catch (Exception $e) {
$result->add_error($this, Dev_Unit_Error::make_from($this, $e));
$is_ok = false;
}
}
try {
$this->before_teardown();
$this->teardown();
$this->after_teardown();
} catch (Exception $e) {
$result->add_error($this, Dev_Unit_Error::make_from($this, $e));
$is_ok = false;
}
if ($is_ok) {
$result->add_success($this);
}
$result->finish_test($this);
return $this;
}
示例11: main
/**
* @return int
*/
public static function main(array $argv)
{
return Core::with(new Service_Twitter_Application())->main($argv);
}
示例12: convert_element
/**
*/
protected function convert_element($element)
{
switch (true) {
case $element instanceof self:
return $element->__value;
case method_exists($element, 'as_array'):
return $element->as_array();
case is_array($element):
return Core::with(new Service_Google_AdWords_Entity($element))->as_array();
default:
return $element;
}
}
示例13: create_response
public function create_response($env)
{
if (!empty($this->callback_result)) {
return $this->callback_result;
}
return Core::with($this->target_instance && $this->target_method ? ($result = $this->execute($this->target_instance, $this->target_method->name, $env, $this->match ? $this->match->parms : array(), $this->format, $this->target_method->defaults)) instanceof Net_HTTP_Response ? $result : Net_HTTP::Response($result)->content_type(!empty($this->format) ? $this->format : self::DEFAULT_CONTENT_TYPE) : Net_HTTP::Response(Net_HTTP::NOT_FOUND));
}
示例14: main
/**
* @param array $argv
*
* @return int
*/
public static function main(array $argv)
{
return Core::with(new Dev_Unit_Run_Text_Application())->main($argv);
}
示例15: body
/**
* Формирует основную часть письма
*
*/
protected function body()
{
$messages_path = Mail_List::option('root') . '/messages';
IO_FS::mkdir($messages_path);
$path = sprintf('%s/%s.body', $messages_path, $this->id);
IO_FS::rm($path);
$f = IO_FS::File($path);
$f->open('w')->write(Core::with(new Mail_List_Encoder())->encode($this->message))->close();
$f->chmod(0664);
return $this;
}