2014-03-11 20:10:50 +00:00
|
|
|
priority -50
|
2013-04-13 17:45:21 +00:00
|
|
|
|
2014-03-11 20:10:50 +00:00
|
|
|
## Snippets from SnipMate, taken from
|
|
|
|
## https://github.com/scrooloose/snipmate-snippets.git
|
2013-04-13 17:45:21 +00:00
|
|
|
|
2014-03-11 20:10:50 +00:00
|
|
|
snippet getter "PHP Class Getter" b
|
2015-02-04 10:43:54 +00:00
|
|
|
/**
|
2014-03-11 20:10:50 +00:00
|
|
|
* Getter for $1
|
2015-02-04 10:43:54 +00:00
|
|
|
*
|
2016-06-11 13:56:50 +00:00
|
|
|
* @return ${2:string}
|
2013-04-13 17:45:21 +00:00
|
|
|
*/
|
2014-03-11 20:10:50 +00:00
|
|
|
public function get${1/\w+\s*/\u$0/}()
|
2013-04-13 17:45:21 +00:00
|
|
|
{
|
2015-02-04 10:43:54 +00:00
|
|
|
return $this->$1;$3
|
2013-04-13 17:45:21 +00:00
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-11 20:10:50 +00:00
|
|
|
snippet setter "PHP Class Setter" b
|
2015-02-04 10:43:54 +00:00
|
|
|
/**
|
2014-03-11 20:10:50 +00:00
|
|
|
* Setter for $1
|
2015-02-04 10:43:54 +00:00
|
|
|
*
|
2016-06-11 13:56:50 +00:00
|
|
|
* @param ${2:string} $$1
|
2015-02-04 10:43:54 +00:00
|
|
|
* @return ${3:`!p snip.rv=snip.basename`}
|
2014-03-11 20:10:50 +00:00
|
|
|
*/
|
2015-02-04 10:43:54 +00:00
|
|
|
public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1)
|
2013-04-13 17:45:21 +00:00
|
|
|
{
|
2015-02-04 10:43:54 +00:00
|
|
|
$this->$1 = $$1;$5
|
2015-07-13 10:22:46 +00:00
|
|
|
|
2015-02-04 10:43:54 +00:00
|
|
|
${6:return $this;}
|
2013-04-13 17:45:21 +00:00
|
|
|
}
|
2014-03-11 20:10:50 +00:00
|
|
|
$0
|
2013-04-13 17:45:21 +00:00
|
|
|
endsnippet
|
|
|
|
|
2014-03-11 20:10:50 +00:00
|
|
|
snippet gs "PHP Class Getter Setter" b
|
2015-02-04 10:43:54 +00:00
|
|
|
/**
|
2014-04-18 12:58:02 +00:00
|
|
|
* Getter for $1
|
2015-02-04 10:43:54 +00:00
|
|
|
*
|
2016-06-11 13:56:50 +00:00
|
|
|
* @return ${2:string}
|
2014-03-11 20:10:50 +00:00
|
|
|
*/
|
2014-04-18 12:58:02 +00:00
|
|
|
public function get${1/\w+\s*/\u$0/}()
|
2013-04-13 17:45:21 +00:00
|
|
|
{
|
2015-02-04 10:43:54 +00:00
|
|
|
return $this->$1;$3
|
2013-04-13 17:45:21 +00:00
|
|
|
}
|
|
|
|
|
2015-02-04 10:43:54 +00:00
|
|
|
/**
|
2014-04-18 12:58:02 +00:00
|
|
|
* Setter for $1
|
2015-02-04 10:43:54 +00:00
|
|
|
*
|
|
|
|
* @param $2 $$1
|
|
|
|
* @return ${4:`!p snip.rv=snip.basename`}
|
2013-08-03 12:50:12 +00:00
|
|
|
*/
|
2015-02-04 10:43:54 +00:00
|
|
|
public function set${1/\w+\s*/\u$0/}(${5:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1)
|
2014-03-11 20:10:50 +00:00
|
|
|
{
|
2015-02-04 10:43:54 +00:00
|
|
|
$this->$1 = $$1;$6
|
2015-07-13 10:22:46 +00:00
|
|
|
|
2015-02-04 10:43:54 +00:00
|
|
|
${7:return $this;}
|
2014-03-11 20:10:50 +00:00
|
|
|
}
|
|
|
|
$0
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet pub "Public function" b
|
2014-10-14 13:30:33 +00:00
|
|
|
/**
|
|
|
|
* ${3:undocumented function}
|
|
|
|
*
|
|
|
|
* @return ${4:void}
|
|
|
|
*/
|
2014-03-11 20:10:50 +00:00
|
|
|
public function ${1:name}(${2:$param})
|
|
|
|
{
|
2014-10-14 13:30:33 +00:00
|
|
|
${VISUAL}${5:return null;}
|
2014-03-11 20:10:50 +00:00
|
|
|
}
|
|
|
|
$0
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet pro "Protected function" b
|
2014-10-14 13:30:33 +00:00
|
|
|
/**
|
|
|
|
* ${3:undocumented function}
|
|
|
|
*
|
|
|
|
* @return ${4:void}
|
|
|
|
*/
|
2014-03-11 20:10:50 +00:00
|
|
|
protected function ${1:name}(${2:$param})
|
|
|
|
{
|
2014-10-14 13:30:33 +00:00
|
|
|
${VISUAL}${5:return null;}
|
2014-03-11 20:10:50 +00:00
|
|
|
}
|
|
|
|
$0
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet pri "Private function" b
|
2014-10-14 13:30:33 +00:00
|
|
|
/**
|
|
|
|
* ${3:undocumented function}
|
|
|
|
*
|
|
|
|
* @return ${4:void}
|
|
|
|
*/
|
2014-03-11 20:10:50 +00:00
|
|
|
private function ${1:name}(${2:$param})
|
2013-04-13 17:45:21 +00:00
|
|
|
{
|
2014-10-14 13:30:33 +00:00
|
|
|
${VISUAL}${5:return null;}
|
2014-03-11 20:10:50 +00:00
|
|
|
}
|
|
|
|
$0
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet pubs "Public static function" b
|
2014-10-14 13:30:33 +00:00
|
|
|
/**
|
|
|
|
* ${3:undocumented function}
|
|
|
|
*
|
|
|
|
* @return ${4:void}
|
|
|
|
*/
|
2014-03-11 20:10:50 +00:00
|
|
|
public static function ${1:name}(${2:$param})
|
|
|
|
{
|
2014-10-14 13:30:33 +00:00
|
|
|
${VISUAL}${5:return null;}
|
2014-03-11 20:10:50 +00:00
|
|
|
}
|
|
|
|
$0
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet pros "Protected static function" b
|
2014-10-14 13:30:33 +00:00
|
|
|
/**
|
|
|
|
* ${3:undocumented function}
|
|
|
|
*
|
|
|
|
* @return ${4:void}
|
|
|
|
*/
|
2014-03-11 20:10:50 +00:00
|
|
|
protected static function ${1:name}(${2:$param})
|
|
|
|
{
|
2014-10-14 13:30:33 +00:00
|
|
|
${VISUAL}${5:return null;}
|
2014-03-11 20:10:50 +00:00
|
|
|
}
|
|
|
|
$0
|
|
|
|
endsnippet
|
2013-04-13 17:45:21 +00:00
|
|
|
|
2014-03-11 20:10:50 +00:00
|
|
|
snippet pris "Private static function" b
|
2014-10-14 13:30:33 +00:00
|
|
|
/**
|
|
|
|
* ${3:undocumented function}
|
|
|
|
*
|
|
|
|
* @return ${4:void}
|
|
|
|
*/
|
2014-03-11 20:10:50 +00:00
|
|
|
private static function ${1:name}(${2:$param})
|
|
|
|
{
|
2014-10-14 13:30:33 +00:00
|
|
|
${VISUAL}${5:return null;}
|
2013-04-13 17:45:21 +00:00
|
|
|
}
|
2014-03-11 20:10:50 +00:00
|
|
|
$0
|
|
|
|
endsnippet
|
2013-04-13 17:45:21 +00:00
|
|
|
|
2014-03-11 20:10:50 +00:00
|
|
|
snippet fu "Function snip" b
|
|
|
|
function ${1:name}(${2:$param})
|
2013-04-13 17:45:21 +00:00
|
|
|
{
|
2014-03-11 20:10:50 +00:00
|
|
|
${VISUAL}${3:return null;}
|
2013-04-13 17:45:21 +00:00
|
|
|
}
|
2014-03-11 20:10:50 +00:00
|
|
|
$0
|
2013-04-13 17:45:21 +00:00
|
|
|
endsnippet
|
|
|
|
|
2014-03-11 20:10:50 +00:00
|
|
|
snippet new "New class instance" b
|
2015-07-13 10:22:46 +00:00
|
|
|
$${1:variableName} = new ${2:${1/\w+\s*/\u$0/}}($3);
|
2014-03-11 20:10:50 +00:00
|
|
|
$0
|
|
|
|
endsnippet
|
|
|
|
|
2015-02-13 00:19:27 +00:00
|
|
|
snippet ns "namespace declaration" b
|
|
|
|
namespace ${1:`!p
|
2016-05-14 11:57:54 +00:00
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
2015-02-13 00:19:27 +00:00
|
|
|
if m:
|
2015-02-24 10:45:22 +00:00
|
|
|
snip.rv = m.group().replace('/', '\\')
|
2015-02-13 00:19:27 +00:00
|
|
|
`};
|
|
|
|
endsnippet
|
|
|
|
|
2014-03-11 20:10:50 +00:00
|
|
|
snippet class "Class declaration template" b
|
2015-02-13 00:19:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ${1:`!p
|
2016-05-14 11:57:54 +00:00
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
2015-02-13 00:19:27 +00:00
|
|
|
if m:
|
2015-02-24 10:45:22 +00:00
|
|
|
snip.rv = m.group().replace('/', '\\')
|
2015-02-13 00:19:27 +00:00
|
|
|
`};
|
|
|
|
|
2014-03-11 20:10:50 +00:00
|
|
|
/**
|
2015-02-13 00:19:27 +00:00
|
|
|
* Class ${1:`!p snip.rv=snip.basename`}
|
|
|
|
* @author ${2:`!v g:snips_author`}
|
2014-10-14 13:30:33 +00:00
|
|
|
*/
|
2015-02-13 00:19:27 +00:00
|
|
|
class $1
|
2014-10-14 13:30:33 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2015-02-13 00:19:27 +00:00
|
|
|
snippet interface "Interface declaration template" b
|
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ${1:`!p
|
2016-05-14 11:57:54 +00:00
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
2015-02-13 00:19:27 +00:00
|
|
|
if m:
|
2015-02-24 10:45:22 +00:00
|
|
|
snip.rv = m.group().replace('/', '\\')
|
2015-02-13 00:19:27 +00:00
|
|
|
`};
|
|
|
|
|
2014-10-14 13:30:33 +00:00
|
|
|
/**
|
2015-02-13 00:19:27 +00:00
|
|
|
* Interface ${1:`!p snip.rv=snip.basename`}
|
2014-03-11 20:10:50 +00:00
|
|
|
* @author ${2:`!v g:snips_author`}
|
|
|
|
*/
|
2014-10-14 13:30:33 +00:00
|
|
|
interface $1
|
2014-03-11 20:10:50 +00:00
|
|
|
{
|
2016-06-11 13:56:50 +00:00
|
|
|
public function ${3:someFunction}();$4
|
2013-11-16 19:45:48 +00:00
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2016-05-14 11:57:54 +00:00
|
|
|
snippet trait "Trait declaration template" b
|
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ${1:`!p
|
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
|
|
if m:
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
`};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Trait ${1:`!p snip.rv=snip.basename`}
|
|
|
|
* @author ${2:`!v g:snips_author`}
|
|
|
|
*/
|
|
|
|
trait $1
|
|
|
|
{
|
|
|
|
}
|
|
|
|
endsnippet
|
2015-02-13 00:19:27 +00:00
|
|
|
|
2014-03-11 20:10:50 +00:00
|
|
|
snippet construct "__construct()" b
|
2013-11-16 19:45:48 +00:00
|
|
|
/**
|
2014-03-11 20:10:50 +00:00
|
|
|
* @param $2mixed ${1/, /\n * \@param mixed /g}
|
2013-11-16 19:45:48 +00:00
|
|
|
*/
|
2014-03-11 20:10:50 +00:00
|
|
|
public function __construct(${1:$dependencies})
|
|
|
|
{${1/\$(\w+)(, )*/\n $this->$1 = $$1;/g}
|
|
|
|
}
|
|
|
|
$0
|
2013-11-16 19:45:48 +00:00
|
|
|
endsnippet
|
2014-03-11 20:10:50 +00:00
|
|
|
|
2016-06-11 13:56:50 +00:00
|
|
|
# PHPUnit snippets
|
|
|
|
snippet testcase "class XYZTest extends \PHPUnit_Framework_TestCase { ... }"
|
|
|
|
<?php
|
2014-03-11 20:10:50 +00:00
|
|
|
|
2016-06-11 13:56:50 +00:00
|
|
|
namespace `!p
|
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
|
|
if m:
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
`;
|
2014-03-11 20:10:50 +00:00
|
|
|
|
2014-10-14 13:30:33 +00:00
|
|
|
/**
|
2016-06-11 13:56:50 +00:00
|
|
|
* @author `!v g:snips_author`
|
2014-10-14 13:30:33 +00:00
|
|
|
*/
|
2016-06-11 13:56:50 +00:00
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
` extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
public function test${1}()
|
|
|
|
{
|
|
|
|
${0:${VISUAL}}
|
|
|
|
}
|
|
|
|
}
|
2014-10-14 13:30:33 +00:00
|
|
|
endsnippet
|
|
|
|
|
2014-03-11 20:10:50 +00:00
|
|
|
# :vim:ft=snippets:
|