-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from oat-sa/php7
First trial PHP7. All pass but seg faults and mm_heap corrupted.
- Loading branch information
Showing
274 changed files
with
3,510 additions
and
3,509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class Boolean extends Scalar | ||
class QtiBoolean extends QtiScalar | ||
{ | ||
/** | ||
* Check whether or not the intrinsic $value is a PHP boolean. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class Coords extends IntegerCollection implements QtiDatatype | ||
class QtiCoords extends IntegerCollection implements QtiDatatype | ||
{ | ||
/** | ||
* A value from the Shape enumeration. | ||
|
@@ -54,28 +54,28 @@ public function __construct($shape, array $coords = array()) | |
$this->setShape($shape); | ||
|
||
switch ($this->getShape()) { | ||
case Shape::DEF: | ||
case QtiShape::DEF: | ||
if (count($this->getDataPlaceHolder()) > 0) { | ||
$msg = "No coordinates should be given when the default shape is used."; | ||
throw new InvalidArgumentException($msg); | ||
} | ||
break; | ||
|
||
case Shape::RECT: | ||
case QtiShape::RECT: | ||
if (count($this->getDataPlaceHolder()) != 4) { | ||
$msg = "The rectangle coordinates must be composed by 4 values (x1, y1, x2, y2)."; | ||
throw new InvalidArgumentException($msg); | ||
} | ||
break; | ||
|
||
case Shape::CIRCLE: | ||
case QtiShape::CIRCLE: | ||
if (count($this->getDataPlaceHolder()) != 3) { | ||
$msg = "The circle coordinates must be composed by 3 values (x, y, r)."; | ||
throw new InvalidArgumentException($msg); | ||
} | ||
break; | ||
|
||
case Shape::POLY: | ||
case QtiShape::POLY: | ||
if (count($this->getDataPlaceHolder()) % 2 > 0) { | ||
$msg = "The polygon coordinates must be composed by a pair amount of values (x1, y1, x2, y2, ...)."; | ||
throw new InvalidArgumentException($msg); | ||
|
@@ -92,7 +92,7 @@ public function __construct($shape, array $coords = array()) | |
*/ | ||
protected function setShape($shape) | ||
{ | ||
if (in_array($shape, Shape::asArray())) { | ||
if (in_array($shape, QtiShape::asArray())) { | ||
$this->shape = $shape; | ||
} else { | ||
$msg = "The shape argument must be a value from the Shape enumeration except 'default', '" . $shape . "' given."; | ||
|
@@ -117,13 +117,13 @@ public function getShape() | |
* @param Point $point A Point object. | ||
* @return boolean | ||
*/ | ||
public function inside(Point $point) | ||
public function inside(QtiPoint $point) | ||
{ | ||
if ($this->getShape() === Shape::DEF) { | ||
if ($this->getShape() === QtiShape::DEF) { | ||
return true; | ||
} elseif ($this->getShape() === Shape::RECT) { | ||
} elseif ($this->getShape() === QtiShape::RECT) { | ||
return $point->getX() >= $this[0] && $point->getX() <= $this[2] && $point->getY() >= $this[1] && $point->getY() <= $this[3]; | ||
} elseif ($this->getShape() === Shape::CIRCLE) { | ||
} elseif ($this->getShape() === QtiShape::CIRCLE) { | ||
return pow($point->getX() - $this[0], 2) + pow($point->getY() - $this[1], 2) < pow($this[2], 2); | ||
} else { | ||
// we consider it is a polygon. | ||
|
@@ -187,7 +187,7 @@ public function __toString() | |
*/ | ||
public function equals($obj) | ||
{ | ||
return $obj instanceof Coords && $this->getShape() === $obj->getShape() && $this->getArrayCopy() == $obj->getArrayCopy(); | ||
return $obj instanceof QtiCoords && $this->getShape() === $obj->getShape() && $this->getArrayCopy() == $obj->getArrayCopy(); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class DirectedPair extends Pair | ||
class QtiDirectedPair extends QtiPair | ||
{ | ||
/** | ||
* Whether or not $obj is equal to $this. Two DirectedPair objects | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class Duration implements QtiDatatype | ||
class QtiDuration implements QtiDatatype | ||
{ | ||
/** | ||
* Internally, the Duration class always | ||
|
@@ -112,7 +112,7 @@ public function __construct($intervalSpec) | |
*/ | ||
public static function createFromDateInterval(DateInterval $interval) | ||
{ | ||
$duration = new Duration('PT0S'); | ||
$duration = new QtiDuration('PT0S'); | ||
$duration->setInterval($interval); | ||
|
||
return $duration; | ||
|
@@ -271,7 +271,7 @@ public function equals($obj) | |
* @param \qtism\common\datatypes\Duration $duration A Duration object to compare with this one. | ||
* @return boolean | ||
*/ | ||
public function shorterThan(Duration $duration) | ||
public function shorterThan(QtiDuration $duration) | ||
{ | ||
return $this->getSeconds(true) < $duration->getSeconds(true); | ||
} | ||
|
@@ -283,7 +283,7 @@ public function shorterThan(Duration $duration) | |
* @param \qtism\common\datatypes\Duration $duration A Duration object to compare with this one. | ||
* @return boolean | ||
*/ | ||
public function longerThanOrEquals(Duration $duration) | ||
public function longerThanOrEquals(QtiDuration $duration) | ||
{ | ||
return $this->getSeconds(true) >= $duration->getSeconds(true); | ||
} | ||
|
@@ -300,7 +300,7 @@ public function add($duration) | |
$d1 = $this->refDate; | ||
$d2 = clone $d1; | ||
|
||
if ($duration instanceof Duration) { | ||
if ($duration instanceof QtiDuration) { | ||
$toAdd = $duration; | ||
} elseif ($duration instanceof DateInterval) { | ||
$toAdd = self::createFromDateInterval($duration); | ||
|
@@ -321,7 +321,7 @@ public function add($duration) | |
* | ||
* For instance P2S - P1S = P1S | ||
*/ | ||
public function sub(Duration $duration) | ||
public function sub(QtiDuration $duration) | ||
{ | ||
if ($duration->longerThanOrEquals($this) === true) { | ||
$this->setInterval(new DateInterval('PT0S')); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
interface File extends QtiDatatype | ||
interface QtiFile extends QtiDatatype | ||
{ | ||
/** | ||
* Get the sequence of bytes composing the file. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class Float extends Scalar | ||
class QtiFloat extends QtiScalar | ||
{ | ||
/** | ||
* Check whether or not $value is a Float object. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class Identifier extends String | ||
class QtiIdentifier extends QtiString | ||
{ | ||
/** | ||
* Checks whether or not $value is a string value. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class IntOrIdentifier extends Scalar | ||
class QtiIntOrIdentifier extends QtiScalar | ||
{ | ||
/** | ||
* Checks whether or not $value is a valid integer or string to be | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class Integer extends Scalar | ||
class QtiInteger extends QtiScalar | ||
{ | ||
/** | ||
* Checks whether or not $value is an integer compliant | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class Pair implements QtiDatatype | ||
class QtiPair implements QtiDatatype | ||
{ | ||
/** | ||
* The first identifier of the Pair. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class Point implements QtiDatatype | ||
class QtiPoint implements QtiDatatype | ||
{ | ||
/** | ||
* The position on the x-axis. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
abstract class Scalar implements QtiDatatype | ||
abstract class QtiScalar implements QtiDatatype | ||
{ | ||
/** | ||
* The value of the Scalar object. | ||
|
@@ -88,7 +88,7 @@ public function getValue() | |
*/ | ||
public function equals($obj) | ||
{ | ||
if ($obj instanceof Scalar) { | ||
if ($obj instanceof QtiScalar) { | ||
return $obj->getValue() === $this->getValue(); | ||
} else { | ||
return $this->getValue() === $obj; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class Shape implements Enumeration | ||
class QtiShape implements Enumeration | ||
{ | ||
/** | ||
* Note: Corresponds to QTI shape::default. Unfortunately, 'default' is a reserved | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class String extends Scalar | ||
class QtiString extends QtiScalar | ||
{ | ||
/** | ||
* Checks whether or not $value is a valid string. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class Uri extends String | ||
class QtiUri extends QtiString | ||
{ | ||
/** | ||
* Checks whether or not $value is a string. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
|
||
use qtism\common\enums\BaseType; | ||
use qtism\common\enums\Cardinality; | ||
use qtism\common\datatypes\File; | ||
use qtism\common\datatypes\QtiFile; | ||
use \RuntimeException; | ||
|
||
/** | ||
|
@@ -34,7 +34,7 @@ | |
* @author Jérôme Bogaerts <[email protected]> | ||
* | ||
*/ | ||
class FileSystemFile implements File | ||
class FileSystemFile implements QtiFile | ||
{ | ||
/** | ||
* The path to the file on the persistent storage. | ||
|
@@ -344,7 +344,7 @@ public function hasFilename() | |
*/ | ||
public function equals($obj) | ||
{ | ||
if ($obj instanceof File) { | ||
if ($obj instanceof QtiFile) { | ||
if ($this->getFilename() !== $obj->getFilename()) { | ||
return false; | ||
} elseif ($this->getMimeType() !== $obj->getMimeType()) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.