@@ -14,6 +14,8 @@ class CodeTables
14
14
15
15
/* @var Client */
16
16
protected $ client ;
17
+
18
+ protected $ codeTables ;
17
19
18
20
public function __construct (Client $ client )
19
21
{
@@ -27,7 +29,9 @@ public function __construct(Client $client)
27
29
*/
28
30
public function getCodeTable ($ codetable )
29
31
{
30
- return json_decode ($ this ->client ->get ($ this ->urlBase ()."/ $ codetable " ));
32
+ $ codeTable = json_decode ($ this ->client ->get ($ this ->urlBase ()."/ $ codetable " ));
33
+ return ($ codeTable );
34
+ #return json_decode($this->client->get($this->urlBase()."/$codetable"));
31
35
}
32
36
33
37
@@ -44,11 +48,26 @@ public function getCodeTableRowByCode($codetable,$code)
44
48
echo "CodeTable: $ codetable \n" ;
45
49
echo "Code: $ code \n" ;
46
50
$ count = 0 ;
47
- foreach ($ this ->getCodeTable ($ codetable ) as $ row ) {
48
- $ count ++;
51
+ $ found = array ();
52
+ $ my_codetable = $ this ->getCodeTable ($ codetable );
53
+ var_dump ($ my_codetable );
54
+ $ rows = $ my_codetable ->row ;
55
+
56
+ print "Name: $ name - Desc: $ desc \n" ;
57
+
58
+ foreach ($ rows as $ row ) {
59
+ #var_dump($row);
60
+ if ($ row ->code == $ code ) {
61
+ array_push ($ found ,$ row );
62
+ $ count ++;
63
+ }
49
64
}
50
- print "Total Rows in $ codetable: $ count \n" ;
51
- return ;
65
+ print "Total Found Rows in $ codetable: $ count \n" ;
66
+
67
+ print "Found: \n" ;
68
+ var_dump ($ found );
69
+
70
+ return ($ found );
52
71
}
53
72
54
73
@@ -59,7 +78,9 @@ public function getCodeTableRowByCode($codetable,$code)
59
78
*/
60
79
public function getCodeTables ()
61
80
{
62
- return json_decode ($ this ->client ->get ($ this ->urlBase ()));
81
+ $ this ->codeTables = json_decode ($ this ->client ->get ($ this ->urlBase ()));
82
+ return ($ this ->codeTables );
83
+ #return json_decode($this->client->get($this->urlBase()));
63
84
}
64
85
65
86
/**
0 commit comments