当前位置: 首页>>代码示例>>PHP>>正文


PHP SplObjectStorage::removeAllExcept方法代码示例

本文整理汇总了PHP中SplObjectStorage::removeAllExcept方法的典型用法代码示例。如果您正苦于以下问题:PHP SplObjectStorage::removeAllExcept方法的具体用法?PHP SplObjectStorage::removeAllExcept怎么用?PHP SplObjectStorage::removeAllExcept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SplObjectStorage的用法示例。


在下文中一共展示了SplObjectStorage::removeAllExcept方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: removeAllExcept

 /**
  * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
  */
 public function removeAllExcept($storage)
 {
     @trigger_error('The ' . __METHOD__ . ' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
     parent::removeAllExcept($storage);
 }
开发者ID:0mars,项目名称:symfony,代码行数:8,代码来源:Crawler.php

示例2: removeAllExcept

 /**
  * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
  */
 public function removeAllExcept($storage)
 {
     $this->triggerDeprecation(__METHOD__);
     parent::removeAllExcept($storage);
 }
开发者ID:hudsonventura,项目名称:ModularCore,代码行数:8,代码来源:Crawler.php

示例3: removeAllExcept

 /**
  * @param \SplObjectStorage $storage
  */
 public function removeAllExcept($storage)
 {
     parent::removeAllExcept($storage);
     $this->unreferenced->removeAllExcept($storage);
 }
开发者ID:mrxotey,项目名称:icicle,代码行数:8,代码来源:ObjectStorage.php

示例4: __construct

	public function __construct($options){
		list($subscribeIfCloseable, $closeSubscribedCloseables) =
			Operators::invoke(static function(){
				$closeables = new \SplObjectStorage();
				return [
					static function($object) use ($closeables){
						if (
							(new \Yasca\Core\IteratorBuilder)
							->from(Iterators::traitsOf($object))
							->contains('Yasca\Core\Closeable')
						){
							$closeables->attach($object);
						}
					},
					static function() use ($closeables){
						foreach($closeables as $closeable){
							$closeable->close();
						}
						$closeables->removeAllExcept(new \SplObjectStorage());
					},
				];
			});

		list($fireLogEvent, $fireResultEvent) =
			Operators::invoke(function() use ($subscribeIfCloseable){
				$newEvent = function($name) use ($subscribeIfCloseable){
					$event = new SplSubjectAdapter();
					$this->{"attach{$name}Observer"} = function(\SplObserver $observer) use ($event, $subscribeIfCloseable){
						$event->attach($observer);
						$subscribeIfCloseable($observer);
						return $this;
					};
					$this->{"detach{$name}Observer"} = function(\SplObserver $observer) use ($event, $subscribeIfCloseable){
						$event->detach($observer);
						$subscribeIfCloseable($observer);
						return $this;
					};
					return static function($value) use ($event){
						$event->raise($value);
					};
				};
				return [
					$newEvent('Log'),
					$newEvent('Result'),
				];
			});

		$targetDirectory =
			(new \Yasca\Core\FunctionPipe)
			->wrap($options)
			->pipe([Iterators::_class,'elementAtOrNull'], 'targetDirectory')
			->pipe('\realpath')
			->unwrap();

		$makeRelative =
			//Make filenames relative when publishing a result
			(new \Yasca\Core\FunctionPipe)
			->wrap($targetDirectory)
			->pipe('\preg_quote', '`')
			->pipe(static function($dirLiteral) { return "`^$dirLiteral`ui"; })
			->pipe(static function($regex){
				return Operators::curry('\preg_replace', $regex, '');
			})
			->unwrap();

		//Wrap Result event trigger to make changes to each Result
		$fireResultEvent = static function(Result $result) use ($fireResultEvent, $makeRelative){
			//Make adjustments based on adjustments data
			(new \Yasca\Core\FunctionPipe)
			->wrap(static::$adjustments)
			->pipe([Iterators::_class, 'elementAtOrNull'], $result->pluginName)
			->pipe([Iterators::_class, 'elementAtOrNull'], $result->category)
			->pipe(static function($options) use ($result){
				if ($options !== null){
					$result->setOptions($options);
				}
			});

			//Get unsafeSourceCode if needed, and then make the filename relative
			//to the scan directory
			if (isset($result->filename) === true && !Operators::isNullOrEmpty($result->filename)){
				if(isset($result->lineNumber) === true && isset($result->unsafeSourceCode) !== true){
					try {
						$result->unsafeSourceCode =
							(new \Yasca\Core\FunctionPipe)
							->wrap($result->filename)
							->pipe([Encoding::_class,'getFileContentsAsArray'])
							->toIteratorBuilder()
							->slice(
								\max($result->lineNumber - 10, 0),
								20
							)
							->toArray(true);
					} catch (\ErrorException $e){
						$tail = 'No such file or directory';
						if (\substr($e->getMessage(),0-strlen($tail)) === $tail){
							//External tool generated a filename that's not present
							//FindBugs can often do this if the matching .java files are missing.
						} else {
							throw $e;
//.........这里部分代码省略.........
开发者ID:gpanda,项目名称:security-scan-tool,代码行数:101,代码来源:scanner.php

示例5: array

<?php

$data_provider = array(array(), true, "string", 12345, 1.2345, NULL);
foreach ($data_provider as $input) {
    $s = new SplObjectStorage();
    var_dump($s->removeAllExcept($input));
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:SplObjectStorage_removeAllExcept_invalid_parameter.php

示例6: SplObjectStorage

<?php

$a = (object) 'a';
$b = (object) 'b';
$c = (object) 'c';
$foo = new SplObjectStorage();
$foo->attach($a);
$foo->attach($b);
$bar = new SplObjectStorage();
$bar->attach($b);
$bar->attach($c);
$foo->removeAllExcept($bar);
var_dump($foo->contains($a));
var_dump($foo->contains($b));
开发者ID:badlamer,项目名称:hhvm,代码行数:14,代码来源:SplObjectStorage_removeAllExcept_basic.php


注:本文中的SplObjectStorage::removeAllExcept方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。