[Beeframework-svn] SF.net SVN: beeframework:[251] trunk/framework/Bee/Context
Brought to you by:
b_hartmann,
m_plomer
From: <m_p...@us...> - 2014-10-09 01:43:59
|
Revision: 251 http://sourceforge.net/p/beeframework/code/251 Author: m_plomer Date: 2014-10-09 01:43:55 +0000 (Thu, 09 Oct 2014) Log Message: ----------- omissions from previous refactorings Modified Paths: -------------- trunk/framework/Bee/Context/AbstractContext.php trunk/framework/Bee/Context/Config/Scope/RequestScope.php Added Paths: ----------- trunk/framework/Bee/Context/Config/BeanDefinition/GenericBeanDefinition.php trunk/framework/Bee/Context/Config/Scope/SessionScope.php Removed Paths: ------------- trunk/framework/Bee/Context/Config/BeanDefinition/Generic.php trunk/framework/Bee/Context/Config/Scope/Session.php Modified: trunk/framework/Bee/Context/AbstractContext.php =================================================================== --- trunk/framework/Bee/Context/AbstractContext.php 2014-10-08 23:50:28 UTC (rev 250) +++ trunk/framework/Bee/Context/AbstractContext.php 2014-10-09 01:43:55 UTC (rev 251) @@ -31,12 +31,13 @@ use Bee\Context\Config\IScopeAware; use Bee\Context\Config\Scope\CacheScope; use Bee\Context\Config\Scope\PrototypeScope; +use Bee\Context\Config\Scope\RequestScope; +use Bee\Context\Config\Scope\SessionScope; use Bee\Context\Support\ContextUtils; use Bee\IContext; use Bee\Utils\Types; use Exception; use ReflectionClass; -use RequestScope; /** * Enter description here... @@ -554,7 +555,7 @@ IBeanDefinition::SCOPE_CACHE => new CacheScope($uniqueId), IBeanDefinition::SCOPE_PROTOTYPE => new PrototypeScope($uniqueId), IBeanDefinition::SCOPE_REQUEST => new RequestScope($uniqueId), - IBeanDefinition::SCOPE_SESSION => new Scope($uniqueId) + IBeanDefinition::SCOPE_SESSION => new SessionScope($uniqueId) ); $this->scopes = $scopes; } Deleted: trunk/framework/Bee/Context/Config/BeanDefinition/Generic.php =================================================================== --- trunk/framework/Bee/Context/Config/BeanDefinition/Generic.php 2014-10-08 23:50:28 UTC (rev 250) +++ trunk/framework/Bee/Context/Config/BeanDefinition/Generic.php 2014-10-09 01:43:55 UTC (rev 251) @@ -1,85 +0,0 @@ -<?php -namespace Bee\Context\Config\BeanDefinition; -/* - * Copyright 2008-2014 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -use Bee\Context\Config\IBeanDefinition; - -/** - * Enter description here... - * - * @author Benjamin Hartmann - * @author Michael Plomer <mic...@it...> - */ -class GenericBeanDefinition extends AbstractBeanDefinition { - - private $parentName; - - /** - * @param IBeanDefinition $original - */ - public function __construct(IBeanDefinition $original = null) { - parent::__construct($original); - } - - /** - * @return String - */ - public function getParentName() { - return $this->parentName; - } - - /** - * @param String $parentName - */ - public function setParentName($parentName) { - $this->parentName = $parentName; - } - - /** - * - * @param $id - * @return void - */ - // todo: this isn't actually a toString()... prints lots of stuff itself... - public function toString($id=null) { - echo '<b>Bean Definition:</b><br/>'; - if (!is_null($id)) { - echo 'id: '.$id.'<br/>'; - } - echo 'class: '.$this->getBeanClassName().'<br/>'; - echo 'Scope: '.$this->getScope().'<br/>'; - $args = $this->getConstructorArgumentValues(); - if (!empty($args)) { - echo '<br/>'; - echo 'constructor args:<br/>'; - foreach ($args as $value) { - var_dump($value); - echo '<br/>'; - } - } - $props = $this->getPropertyValues(); - if (!empty($props)) { - echo '<br/>'; - echo 'properties:<br/>'; - foreach ($props as $key => $value) { - echo "$key: "; - var_dump($value); - echo '<br/>'; - } - } - echo '<hr/>'; - } -} Copied: trunk/framework/Bee/Context/Config/BeanDefinition/GenericBeanDefinition.php (from rev 250, trunk/framework/Bee/Context/Config/BeanDefinition/Generic.php) =================================================================== --- trunk/framework/Bee/Context/Config/BeanDefinition/GenericBeanDefinition.php (rev 0) +++ trunk/framework/Bee/Context/Config/BeanDefinition/GenericBeanDefinition.php 2014-10-09 01:43:55 UTC (rev 251) @@ -0,0 +1,85 @@ +<?php +namespace Bee\Context\Config\BeanDefinition; +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +use Bee\Context\Config\IBeanDefinition; + +/** + * Enter description here... + * + * @author Benjamin Hartmann + * @author Michael Plomer <mic...@it...> + */ +class GenericBeanDefinition extends AbstractBeanDefinition { + + private $parentName; + + /** + * @param IBeanDefinition $original + */ + public function __construct(IBeanDefinition $original = null) { + parent::__construct($original); + } + + /** + * @return String + */ + public function getParentName() { + return $this->parentName; + } + + /** + * @param String $parentName + */ + public function setParentName($parentName) { + $this->parentName = $parentName; + } + + /** + * + * @param $id + * @return void + */ + // todo: this isn't actually a toString()... prints lots of stuff itself... + public function toString($id=null) { + echo '<b>Bean Definition:</b><br/>'; + if (!is_null($id)) { + echo 'id: '.$id.'<br/>'; + } + echo 'class: '.$this->getBeanClassName().'<br/>'; + echo 'Scope: '.$this->getScope().'<br/>'; + $args = $this->getConstructorArgumentValues(); + if (!empty($args)) { + echo '<br/>'; + echo 'constructor args:<br/>'; + foreach ($args as $value) { + var_dump($value); + echo '<br/>'; + } + } + $props = $this->getPropertyValues(); + if (!empty($props)) { + echo '<br/>'; + echo 'properties:<br/>'; + foreach ($props as $key => $value) { + echo "$key: "; + var_dump($value); + echo '<br/>'; + } + } + echo '<hr/>'; + } +} Modified: trunk/framework/Bee/Context/Config/Scope/RequestScope.php =================================================================== --- trunk/framework/Bee/Context/Config/Scope/RequestScope.php 2014-10-08 23:50:28 UTC (rev 250) +++ trunk/framework/Bee/Context/Config/Scope/RequestScope.php 2014-10-09 01:43:55 UTC (rev 251) @@ -1,4 +1,5 @@ <?php +namespace Bee\Context\Config\Scope; /* * Copyright 2008-2014 the original author or authors. * Deleted: trunk/framework/Bee/Context/Config/Scope/Session.php =================================================================== --- trunk/framework/Bee/Context/Config/Scope/Session.php 2014-10-08 23:50:28 UTC (rev 250) +++ trunk/framework/Bee/Context/Config/Scope/Session.php 2014-10-09 01:43:55 UTC (rev 251) @@ -1,74 +0,0 @@ -<?php -/* - * Copyright 2008-2010 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -use Bee\Context\Config\IObjectFactory; -use Bee\Context\Config\IScope; - -/** - * Enter description here... - * - * @author Benjamin Hartmann - * @author Michael Plomer <mic...@it...> - */ -class SessionScope implements IScope { - - const SESSION_SCOPE_PREFIX = '__sessionScopeContent'; - - /** - * @var - */ - private $id; - - /** - * @param $id - */ - public function __construct($id) { - $this->id = $id; - } - - /** - * @param string $beanName - * @param IObjectFactory $objectFactory - * @return mixed|Object - */ - public function get($beanName, IObjectFactory $objectFactory) { - $beans =& $_SESSION[$this->id.self::SESSION_SCOPE_PREFIX]; - $scopedObject =& $beans[$beanName]; - if(is_null($scopedObject)) { - $scopedObject =& $objectFactory->getObject(); - $beans[$beanName] =& $scopedObject; - } - return $scopedObject; - } - - /** - * @param $beanName - * @return Object - */ - public function remove($beanName) { - $beans =& $_SESSION[$this->id.self::SESSION_SCOPE_PREFIX]; - $bean = $beans[$beanName]; - unset($beans[$beanName]); - return $bean; - } - - /** - * @return string - */ - public function getConversationId() { - return session_id(); - } -} \ No newline at end of file Copied: trunk/framework/Bee/Context/Config/Scope/SessionScope.php (from rev 250, trunk/framework/Bee/Context/Config/Scope/Session.php) =================================================================== --- trunk/framework/Bee/Context/Config/Scope/SessionScope.php (rev 0) +++ trunk/framework/Bee/Context/Config/Scope/SessionScope.php 2014-10-09 01:43:55 UTC (rev 251) @@ -0,0 +1,75 @@ +<?php +namespace Bee\Context\Config\Scope; +/* + * Copyright 2008-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +use Bee\Context\Config\IObjectFactory; +use Bee\Context\Config\IScope; + +/** + * Enter description here... + * + * @author Benjamin Hartmann + * @author Michael Plomer <mic...@it...> + */ +class SessionScope implements IScope { + + const SESSION_SCOPE_PREFIX = '__sessionScopeContent'; + + /** + * @var + */ + private $id; + + /** + * @param $id + */ + public function __construct($id) { + $this->id = $id; + } + + /** + * @param string $beanName + * @param IObjectFactory $objectFactory + * @return mixed|Object + */ + public function get($beanName, IObjectFactory $objectFactory) { + $beans =& $_SESSION[$this->id.self::SESSION_SCOPE_PREFIX]; + $scopedObject =& $beans[$beanName]; + if(is_null($scopedObject)) { + $scopedObject =& $objectFactory->getObject(); + $beans[$beanName] =& $scopedObject; + } + return $scopedObject; + } + + /** + * @param $beanName + * @return Object + */ + public function remove($beanName) { + $beans =& $_SESSION[$this->id.self::SESSION_SCOPE_PREFIX]; + $bean = $beans[$beanName]; + unset($beans[$beanName]); + return $bean; + } + + /** + * @return string + */ + public function getConversationId() { + return session_id(); + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |