Skip to content

Instantly share code, notes, and snippets.

@jimmylatreille
Last active December 19, 2015 09:49
Show Gist options
  • Save jimmylatreille/5935625 to your computer and use it in GitHub Desktop.
Save jimmylatreille/5935625 to your computer and use it in GitHub Desktop.
Snippet pour les class PHP
<snippet>
<content><![CDATA[
class ${1:className} {
//variable instance
private \$${2:val};
//constructeur
function __construct(\$${2:val}){
\$this->${2:val} = \$${2:val};
} //fin constructeur ${1:className}
//Getter ${2:val}()
public function get${2/(?:^|_)(\w)/\U$1$2/g$1}(){
return \$this->${2:val};
}
//Setter ${2:val}()
public function set${2/(?:^|_)(\w)/\U$1$2/g$1}(\$${2:val}){
\$this->${2:val} = \$${2:val};
}
} // fin de la class ${1:className}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>pclass</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment