Skip to content

Commit 1121324

Browse files
committed
Added default interface.
1 parent 0036146 commit 1121324

File tree

3 files changed

+116
-38
lines changed

3 files changed

+116
-38
lines changed

source/Jocic/Encoders/Base/Base32.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
namespace Jocic\Encoders\Base;
3333

34+
use Jocic\Encoders\EncoderInterface;
35+
3436
/**
3537
* <i>Base32</i> class is used for encoding data in <i>Base 32</i> format.
3638
*
@@ -39,7 +41,7 @@
3941
* @version 1.0.0
4042
*/
4143

42-
class Base32 implements BaseInterface
44+
class Base32 implements DefaultInterface, BaseInterface
4345
{
4446
/******************\
4547
|* CORE CONSTANTS *|

source/Jocic/Encoders/Base/BaseInterface.php

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -77,48 +77,13 @@ public function getBasePadding();
7777
|* CORE METHODS *|
7878
\****************/
7979

80-
/**
81-
* Encodes a provided string to a desired <i>Base</i> encoding.
82-
*
83-
* @author Djordje Jocic <[email protected]>
84-
* @copyright 2019 All Rights Reserved
85-
* @version 1.0.0
86-
*
87-
* @param string $input
88-
* Input string that needs to be encoded.
89-
*/
90-
91-
public function encode($input);
92-
93-
/**
94-
* Encodes a provided string to a desired <i>Base</i> decoding.
95-
*
96-
* @author Djordje Jocic <[email protected]>
97-
* @copyright 2019 All Rights Reserved
98-
* @version 1.0.0
99-
*
100-
* @param string $input
101-
* Input string that needs to be decoding.
102-
*/
103-
104-
public function decode($input);
80+
// CORE METHODS GO HERE
10581

10682
/*****************\
10783
|* CHECK METHODS *|
10884
\*****************/
10985

110-
/**
111-
* Checks if a provided encoding is valid or not.
112-
*
113-
* @author Djordje Jocic <[email protected]>
114-
* @copyright 2019 All Rights Reserved
115-
* @version 1.0.0
116-
*
117-
* @param string $encoding
118-
* Encoding that needs to be checked.
119-
*/
120-
121-
public function isEncodingValid($encoding);
86+
// CHECK METHODS GO HERE
12287

12388
/*****************\
12489
|* OTHER METHODS *|
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?php
2+
3+
/*******************************************************************\
4+
|* Author: Djordje Jocic *|
5+
|* Year: 2019 *|
6+
|* License: MIT License (MIT) *|
7+
|* =============================================================== *|
8+
|* Personal Website: http://www.djordjejocic.com/ *|
9+
|* =============================================================== *|
10+
|* Permission is hereby granted, free of charge, to any person *|
11+
|* obtaining a copy of this software and associated documentation *|
12+
|* files (the "Software"), to deal in the Software without *|
13+
|* restriction, including without limitation the rights to use, *|
14+
|* copy, modify, merge, publish, distribute, sublicense, and/or *|
15+
|* sell copies of the Software, and to permit persons to whom the *|
16+
|* Software is furnished to do so, subject to the following *|
17+
|* conditions. *|
18+
|* --------------------------------------------------------------- *|
19+
|* The above copyright notice and this permission notice shall be *|
20+
|* included in all copies or substantial portions of the Software. *|
21+
|* --------------------------------------------------------------- *|
22+
|* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *|
23+
|* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *|
24+
|* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *|
25+
|* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *|
26+
|* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, *|
27+
|* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, RISING *|
28+
|* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *|
29+
|* OTHER DEALINGS IN THE SOFTWARE. *|
30+
\*******************************************************************/
31+
32+
namespace Jocic\Encoders\Base;
33+
34+
/**
35+
* <i>DefaultInterface</i> is an interface used to enforce implementation of
36+
* core default encoder's methods.
37+
*
38+
* @author Djordje Jocic <[email protected]>
39+
* @copyright 2019 All Rights Reserved
40+
* @version 1.0.0
41+
*/
42+
43+
interface DefaultInterface
44+
{
45+
/***************\
46+
|* GET METHODS *|
47+
\***************/
48+
49+
// GET METHODS GO HERE
50+
51+
/***************\
52+
|* SET METHODS *|
53+
\***************/
54+
55+
// SET METHODS GO HERE
56+
57+
/****************\
58+
|* CORE METHODS *|
59+
\****************/
60+
61+
/**
62+
* Encodes a provided string to a desired <i>Base</i> encoding.
63+
*
64+
* @author Djordje Jocic <[email protected]>
65+
* @copyright 2019 All Rights Reserved
66+
* @version 1.0.0
67+
*
68+
* @param string $input
69+
* Input string that needs to be encoded.
70+
*/
71+
72+
public function encode($input);
73+
74+
/**
75+
* Encodes a provided string to a desired <i>Base</i> decoding.
76+
*
77+
* @author Djordje Jocic <[email protected]>
78+
* @copyright 2019 All Rights Reserved
79+
* @version 1.0.0
80+
*
81+
* @param string $input
82+
* Input string that needs to be decoding.
83+
*/
84+
85+
public function decode($input);
86+
87+
/*****************\
88+
|* CHECK METHODS *|
89+
\*****************/
90+
91+
/**
92+
* Checks if a provided encoding is valid or not.
93+
*
94+
* @author Djordje Jocic <[email protected]>
95+
* @copyright 2019 All Rights Reserved
96+
* @version 1.0.0
97+
*
98+
* @param string $encoding
99+
* Encoding that needs to be checked.
100+
*/
101+
102+
public function isEncodingValid($encoding);
103+
104+
/*****************\
105+
|* OTHER METHODS *|
106+
\*****************/
107+
108+
// OTHER METHODS GO HERE
109+
}
110+
111+
?>

0 commit comments

Comments
 (0)