File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace QuickBooksOnline \API \Facades ;
3
+
4
+ class Term{
5
+
6
+ public static function create (array $ data , $ throwException = TRUE ){
7
+ if (!isset ($ data ) || empty ($ data )) throw new \Exception ("Passed array for creating Term is Empty " );
8
+ $ TermObject = FacadeHelper::reflectArrayToObject ("Term " , $ data , $ throwException );
9
+ return $ TermObject ;
10
+ }
11
+
12
+ /**
13
+ * This is an immutable function
14
+ */
15
+ public static function update ($ objToUpdate , array $ data ){
16
+ $ classOfObj = get_class ($ objToUpdate );
17
+ if (strcmp ($ classOfObj , FacadeHelper::simpleAppendClassNameSpace ("Term " )) != 0 ){
18
+ throw new \Exception ("Target object class:{ " . $ classOfObj . "} is not an instance of Term. " );
19
+ }
20
+ $ newTermObj = Term::create ($ data );
21
+ $ clonedOfObj = FacadeHelper::cloneObj ($ objToUpdate );
22
+ FacadeHelper::mergeObj ($ clonedOfObj , $ newTermObj );
23
+ return $ clonedOfObj ;
24
+ }
25
+
26
+ }
You can’t perform that action at this time.
0 commit comments