本文整理汇总了PHP中Rectangle::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Rectangle::isValid方法的具体用法?PHP Rectangle::isValid怎么用?PHP Rectangle::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rectangle
的用法示例。
在下文中一共展示了Rectangle::isValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveRectangle
function saveRectangle()
{
if (!isset($_POST['topA']) || !isset($_POST['topB']) || !isset($_POST['leftA']) || !isset($_POST['leftB'])) {
return array("success" => false, "error" => "Wrong formatted request");
}
$rectangle = new Rectangle((int) $_POST['topA'], (int) $_POST['leftA'], (int) $_POST['topB'], (int) $_POST['leftB']);
if ($rectangle->save()) {
return array("success" => true);
}
return array("success" => false, "error" => $rectangle->isValid() ? "Oops, something went wrong when saving the rectangle" : "Rectangle with no width and height cannot be registered.");
}
示例2: addElementRectangle
/**
* Add rectangle to map
* @param string $value
* @return boolean
*/
public function addElementRectangle($value)
{
$return = true;
$stringsrectangle = explode($GLOBALS['egMultiMaps_SeparatorItems'], $value);
foreach ($stringsrectangle as $rectanglevalue) {
if (trim($rectanglevalue) == '') {
continue;
}
$rectangle = new Rectangle();
if (!$rectangle->parse($rectanglevalue, $this->classname)) {
$return = false;
$this->errormessages = array_merge($this->errormessages, $rectangle->getErrorMessages());
}
if (!$rectangle->isValid()) {
continue;
}
$this->rectangles[] = $rectangle;
$this->elementsBounds->extend($rectangle->pos);
}
return $return;
}