PluginProbe
Texty – SMS Notification for WordPress, WooCommerce, Dokan and more / trunk
Texty – SMS Notification for WordPress, WooCommerce, Dokan and more vtrunk
2.0.2 trunk 0.2 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 2.0.0 2.0.1
texty / includes / Gateways / Fake.php

Fake.php in Texty – SMS Notification for WordPress, WooCommerce, Dokan and more trunk, at includes/Gateways/Fake.php

88 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Texty\Gateways;
4
5 use WP_Error;
6
7 /**
8 * Twilio Class
9 *
10 * @see https://www.twilio.com/docs/sms/api/message
11 */
12 class Fake implements GatewayInterface {
13
14 /**
15 * Get the display order.
16 *
17 * @return int
18 */
19 public function order() {
20 return 99;
21 }
22
23 /**
24 * Get the name
25 *
26 * @return string
27 */
28 public function name() {
29 return __( 'Fake Gateway', 'texty' );
30 }
31
32 /**
33 * Get the name
34 *
35 * @return string
36 */
37 public function description() {
38 return __( 'This is a fake gateway that logs the messages to <code>debug.log</code> file without sending the actual SMS.', 'texty' );
39 }
40
41 /**
42 * Get the logo
43 *
44 * @return string
45 */
46 public function logo() {
47 return TEXTY_URL . '/assets/images/gateways/common-sms.png';
48 }
49
50 /**
51 * Get the settings
52 *
53 * @return array
54 */
55 public function get_settings() {
56 return [];
57 }
58
59 /**
60 * Send SMS
61 *
62 * @param string $to
63 * @param string $message
64 *
65 * @return WP_Error|array
66 */
67 public function send( $to, $message ) {
68 $message = sprintf( 'To: %s; Message: %s', $to, $message );
69 error_log( $message );
70
71 return [
72 'success' => true,
73 'reference_id' => 'fake_' . time(),
74 ];
75 }
76
77 /**
78 * Validate a REST API request
79 *
80 * @param WP_REST_Request $request
81 *
82 * @return WP_Error|true
83 */
84 public function validate( $request ) {
85 return [];
86 }
87 }
88