-
Notifications
You must be signed in to change notification settings - Fork 1
/
getsetstorage.sublime-snippet
64 lines (57 loc) · 1.65 KB
/
getsetstorage.sublime-snippet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<snippet>
<content><![CDATA[
//--- ${1:$SELECTION} / $2 ---//
/**
* @var \\TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage<$3>
* @lazy
*/
protected \$${1/_(\w)/\U$1/g$1};
/**
* Getter for ${1/_(\w)/\U$1/g$1}
*
* @return \\TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage
*/
public function get${1/(?:^|_)(\w)/\U$1$2/g$1}() {
return \$this->${1/_(\w)/\U$1/g$1};
}
/**
* Setter for ${1/_(\w)/\U$1/g$1}
*
* @param \\TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage \$${1/_(\w)/\U$1/g$1}
* @return void
*/
public function set${1/(?:^|_)(\w)/\U$1$2/g$1}(\\TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage \$${1/_(\w)/\U$1/g$1}) {
\$this->${1/_(\w)/\U$1/g$1} = \$${1/_(\w)/\U$1/g$1};
}
/**
* Adds a ${2/_(\w)/\U$1/g$1}
*
* @param $3 \$${2/_(\w)/\U$1/g$1}
* @return void
*/
public function add${2/(?:^|_)(\w)/\U$1$2/g$1}($3 \$${2/_(\w)/\U$1/g$1}) {
\$this->${1/_(\w)/\U$1/g$1}->attach(\$${2/_(\w)/\U$1/g$1});
}
/**
* Removes a ${2/_(\w)/\U$1/g$1}
*
* @param $3 \$${2/_(\w)/\U$1/g$1}
* @return void
*/
public function remove${2/(?:^|_)(\w)/\U$1$2/g$1}($3 \$${2/_(\w)/\U$1/g$1}) {
\$this->${1/_(\w)/\U$1/g$1}->detach(\$${2/_(\w)/\U$1/g$1});
}
/**
* @return void
*/
public function removeAll${1/(?:^|_)(\w)/\U$1$2/g$1}() {
\$this->${1/_(\w)/\U$1/g$1} = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>gss</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.php</scope>
<!-- Optional: Description to show in the menu -->
<description>Create getter and setter methods for Storage Object</description>
</snippet>