@@ -15,6 +15,12 @@ class Operator
1515 public function __construct ($ client )
1616 {
1717 $ this ->_client = $ client ;
18+
19+ if (is_null ($ this ->_wrapperTag )) {
20+ $ classNameParts = explode ('\\' , get_class ($ this ));
21+ $ this ->_wrapperTag = end ($ classNameParts );
22+ $ this ->_wrapperTag = strtolower (preg_replace ('/([a-z])([A-Z])/ ' , '\1-\2 ' , $ this ->_wrapperTag ));
23+ }
1824 }
1925
2026 /**
@@ -28,12 +34,6 @@ public function request($request, $mode = Client::RESPONSE_SHORT)
2834 {
2935 $ wrapperTag = $ this ->_wrapperTag ;
3036
31- if (is_null ($ wrapperTag )) {
32- $ classNameParts = explode ('\\' , get_class ($ this ));
33- $ wrapperTag = end ($ classNameParts );
34- $ wrapperTag = strtolower (preg_replace ('/([a-z])([A-Z])/ ' , '\1-\2 ' , $ wrapperTag ));
35- }
36-
3737 if (is_array ($ request )) {
3838 $ request = [$ wrapperTag => $ request ];
3939 } else if (preg_match ('/^[a-z]/ ' , $ request )) {
@@ -45,4 +45,16 @@ public function request($request, $mode = Client::RESPONSE_SHORT)
4545 return $ this ->_client ->request ($ request , $ mode );
4646 }
4747
48+ /**
49+ * @param string $field
50+ * @param integer|string $value
51+ * @param string $deleteMethodName
52+ * @return bool
53+ */
54+ public function _delete ($ field , $ value , $ deleteMethodName = 'del ' )
55+ {
56+ $ response = $ this ->request ("$ deleteMethodName.filter. $ field= $ value " );
57+ return 'ok ' === (string )$ response ->status ;
58+ }
59+
4860}
0 commit comments