/** * Disconnect / Reset the Webservice Socket. * * @return boolean **/ function serviceDisconnect(&$Model) { if ($this->Socket !== null) { $this->Socket->disconnect(); $this->Socket->reset(); } }
public function reset() { parent::reset(); $this->authToken = ""; $this->mailAuthToken = ""; $this->isAdmin = false; $this->isVerified = false; }
public function reset() { parent::reset(); $this->ipAddr = null; $this->title = null; $this->hashtags = null; $this->cname = null; $this->body = null; $this->featured = false; $this->albumId = 0; }
public function reset() { parent::reset(); $this->start = null; $this->end = null; $this->title = null; $this->cname = null; $this->location = null; $this->description = null; $this->featured = false; $this->hashtags = null; $this->albumId = 0; }
public function reset() { parent::reset(); $this->body = null; }
public function testSandboxGloballySet() { $twig = $this->getEnvironment(false, array(), self::$templates); $this->assertEquals('FOO', $twig->loadTemplate('1_basic')->render(self::$params), 'Sandbox does nothing if it is disabled globally'); $twig = $this->getEnvironment(true, array(), self::$templates); try { $twig->loadTemplate('1_basic1')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if an unallowed method is called'); } catch (Twig_Sandbox_SecurityError $e) { } $twig = $this->getEnvironment(true, array(), self::$templates); try { $twig->loadTemplate('1_basic2')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if an unallowed filter is called'); } catch (Twig_Sandbox_SecurityError $e) { } $twig = $this->getEnvironment(true, array(), self::$templates); try { $twig->loadTemplate('1_basic3')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if an unallowed tag is used in the template'); } catch (Twig_Sandbox_SecurityError $e) { } $twig = $this->getEnvironment(true, array(), self::$templates); try { $twig->loadTemplate('1_basic4')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if an unallowed property is called in the template'); } catch (Twig_Sandbox_SecurityError $e) { } $twig = $this->getEnvironment(true, array(), self::$templates); try { $twig->loadTemplate('1_basic5')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); } catch (Twig_Sandbox_SecurityError $e) { } $twig = $this->getEnvironment(true, array(), self::$templates); try { $twig->loadTemplate('1_basic6')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); } catch (Twig_Sandbox_SecurityError $e) { } $twig = $this->getEnvironment(true, array(), self::$templates); try { $twig->loadTemplate('1_basic7')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if an unallowed function is called in the template'); } catch (Twig_Sandbox_SecurityError $e) { } $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('Object' => 'foo')); Object::reset(); $this->assertEquals('foo', $twig->loadTemplate('1_basic1')->render(self::$params), 'Sandbox allow some methods'); $this->assertEquals(1, Object::$called['foo'], 'Sandbox only calls method once'); $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('Object' => '__toString')); Object::reset(); $this->assertEquals('foo', $twig->loadTemplate('1_basic5')->render(self::$params), 'Sandbox allow some methods'); $this->assertEquals(1, Object::$called['__toString'], 'Sandbox only calls method once'); $twig = $this->getEnvironment(true, array(), self::$templates, array(), array('upper')); $this->assertEquals('FABIEN', $twig->loadTemplate('1_basic2')->render(self::$params), 'Sandbox allow some filters'); $twig = $this->getEnvironment(true, array(), self::$templates, array('if')); $this->assertEquals('foo', $twig->loadTemplate('1_basic3')->render(self::$params), 'Sandbox allow some tags'); $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array('Object' => 'bar')); $this->assertEquals('bar', $twig->loadTemplate('1_basic4')->render(self::$params), 'Sandbox allow some properties'); $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array(), array('cycle')); $this->assertEquals('bar', $twig->loadTemplate('1_basic7')->render(self::$params), 'Sandbox allow some functions'); foreach (array('getfoobar', 'getFoobar', 'getFooBar') as $name) { $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('Object' => $name)); Object::reset(); $this->assertEquals('foobarfoobar', $twig->loadTemplate('1_basic8')->render(self::$params), 'Sandbox allow methods in a case-insensitive way'); $this->assertEquals(2, Object::$called['getFooBar'], 'Sandbox only calls method once'); } }
/** * Resets member variables to their pristine state. */ public function reset() { parent::reset(); $this->title = null; $this->system = false; }