private function isCorrectValueType($value) { if ($this->valueType === "?") { return true; } return $this->valueType === TypeUtil::getType($value); }
public function add($element) { if (!$this->isCorrectType($element)) { throw new IllegalArgumentException("Tried to add element of type " . TypeUtil::getType($element) . " to list of type " . $this->type); } $this->elements[$element] = $element; }
<?php /* This file is part of the Pastebin package. Copyright (c) 2003-2008, Stephen Olesen All rights reserved. More information is available at http://pastebin.ca/ */ require_once "include/global.inc.php"; $tpl = new Template(); $tpl->assign('typeOptions', TypeUtil::getOptionList()); if (isset($_GET["id"])) { $p = new Paste(); if ($p->load($_GET["id"])) { $tpl->assign('paste', $p); $tpl->headers(); if ($p->id_mask != null) { $tpl->assign('urlid', $p->id_mask); } else { $tpl->assign('urlid', $p->id); } $tpl->assign('title', _("General Pastebin") . " - " . htmlentities($p->poster, ENT_COMPAT, "UTF-8") . " - " . _("Paste number") . " " . $p->id); $tpl->display('paste-main.tpl', $p->id); exit; } } $tpl->headers(); $tpl->display('main.tpl');
protected function isCorrectType($element) { if ($this->type === "?") { return true; } return $this->type === TypeUtil::getType($element); }
function testPrimitiveIsNotObjectType() { $this->assertFalse(TypeUtil::isObjectType("string")); }
function testSampleNotComparable() { $this->assertFalse(TypeUtil::isClassComparable("SampleNotComparable")); }
function testObjectIsNotPrimitive() { $this->assertFalse(TypeUtil::isPrimitive("IsPrimitiveTypeTest")); }