-
Notifications
You must be signed in to change notification settings - Fork 269
/
Copy pathPoint.inc
57 lines (46 loc) · 955 Bytes
/
Point.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/*
+-------------------------------------------------------------+
| Copyright (c) 2014 Facebook, Inc. (http://www.facebook.com) |
+-------------------------------------------------------------+
*/
error_reporting(-1);
class Point implements Serializable
{
private static $pointCount = 0;
public $x;
public $y;
public static function getPointCount()
{
return self::$pointCount;
}
public function __construct($x = 0, $y = 0)
{
$this->x = $x;
$this->y = $y;
++self::$pointCount;
}
public function __destruct()
{
--self::$pointCount;
}
///*
public function __clone()
{
++self::$pointCount;
// echo "Inside " . __METHOD__ . ", point count = " . self::$pointCount . "\n";
}
//*/
public function __toString()
{
return '(' . $this->x . ',' . $this->y . ')';
}
public function serialize()
{
return serialize( /*...*/ );
}
public function unserialize($data)
{
// ... = unserialize($data);
}
}