repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
webforge-labs/psc-cms | lib/Psc/Doctrine/PhpParser.php | PhpParser.parseClass | public function parseClass(\ReflectionClass $class)
{
if (false === $filename = $class->getFilename()) {
return array();
}
$content = $this->getFileContent($filename, $class->getStartLine());
$namespace = str_replace('\\', '\\\\', $class->getNamespaceName());
$co... | php | public function parseClass(\ReflectionClass $class)
{
if (false === $filename = $class->getFilename()) {
return array();
}
$content = $this->getFileContent($filename, $class->getStartLine());
$namespace = str_replace('\\', '\\\\', $class->getNamespaceName());
$co... | [
"public",
"function",
"parseClass",
"(",
"\\",
"ReflectionClass",
"$",
"class",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"filename",
"=",
"$",
"class",
"->",
"getFilename",
"(",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"content",
"... | Parses a class.
@param \ReflectionClass $class A <code>ReflectionClass</code> object.
@return array A list with use statements in the form (Alias => FQN). | [
"Parses",
"a",
"class",
"."
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/PhpParser.php#L58-L74 |
webforge-labs/psc-cms | lib/Psc/Doctrine/PhpParser.php | PhpParser.parseUseStatement | private function parseUseStatement()
{
$class = '';
$alias = '';
$statements = array();
$explicitAlias = false;
while (($token = $this->next())) {
$isNameToken = $token[0] === T_STRING || $token[0] === T_NS_SEPARATOR;
if (!$explicitAlias && $isNameToke... | php | private function parseUseStatement()
{
$class = '';
$alias = '';
$statements = array();
$explicitAlias = false;
while (($token = $this->next())) {
$isNameToken = $token[0] === T_STRING || $token[0] === T_NS_SEPARATOR;
if (!$explicitAlias && $isNameToke... | [
"private",
"function",
"parseUseStatement",
"(",
")",
"{",
"$",
"class",
"=",
"''",
";",
"$",
"alias",
"=",
"''",
";",
"$",
"statements",
"=",
"array",
"(",
")",
";",
"$",
"explicitAlias",
"=",
"false",
";",
"while",
"(",
"(",
"$",
"token",
"=",
"$... | Parse a single use statement.
@return array A list with all found class names for a use statement. | [
"Parse",
"a",
"single",
"use",
"statement",
"."
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/PhpParser.php#L195-L225 |
yuncms/framework | src/oauth2/grant/types/ClientCredentials.php | ClientCredentials.getUser | protected function getUser()
{
if ($this->_user === null) {
$this->_user = $this->getClient()->user;
}
return $this->_user;
} | php | protected function getUser()
{
if ($this->_user === null) {
$this->_user = $this->getClient()->user;
}
return $this->_user;
} | [
"protected",
"function",
"getUser",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_user",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_user",
"=",
"$",
"this",
"->",
"getClient",
"(",
")",
"->",
"user",
";",
"}",
"return",
"$",
"this",
"->",
"_u... | Finds user
@return \yuncms\user\models\User|null
@throws \yuncms\oauth2\Exception | [
"Finds",
"user"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/oauth2/grant/types/ClientCredentials.php#L108-L114 |
antonmedv/silicone | src/Silicone/Routing/Loader/AnnotatedRouteControllerLoader.php | AnnotatedRouteControllerLoader.getDefaultRouteName | protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method)
{
$routeName = parent::getDefaultRouteName($class, $method);
return preg_replace(array(
'/(module_|controller_?)/',
'/__/'
), array(
'_',
'_'
),... | php | protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method)
{
$routeName = parent::getDefaultRouteName($class, $method);
return preg_replace(array(
'/(module_|controller_?)/',
'/__/'
), array(
'_',
'_'
),... | [
"protected",
"function",
"getDefaultRouteName",
"(",
"\\",
"ReflectionClass",
"$",
"class",
",",
"\\",
"ReflectionMethod",
"$",
"method",
")",
"{",
"$",
"routeName",
"=",
"parent",
"::",
"getDefaultRouteName",
"(",
"$",
"class",
",",
"$",
"method",
")",
";",
... | Makes the default route name more sane by removing common keywords.
@param \ReflectionClass $class A ReflectionClass instance
@param \ReflectionMethod $method A ReflectionMethod instance
@return string | [
"Makes",
"the",
"default",
"route",
"name",
"more",
"sane",
"by",
"removing",
"common",
"keywords",
"."
] | train | https://github.com/antonmedv/silicone/blob/e4a67ed41f0f419984df642b303f2a491c9a3933/src/Silicone/Routing/Loader/AnnotatedRouteControllerLoader.php#L36-L47 |
webforge-labs/psc-cms | lib/Psc/UI/jqx/TabsSpecification.php | TabsSpecification.getWidgetOptions | public function getWidgetOptions() {
$options = new \stdClass;
foreach (array('width','height','disabled','scrollAnimationDuration','enabledHover','collapsible','animationType','enableScrollAnimation','contentTransitionDuration','toggleMode','selectedItem','position','selectionTracker','scrollable','scrollPosit... | php | public function getWidgetOptions() {
$options = new \stdClass;
foreach (array('width','height','disabled','scrollAnimationDuration','enabledHover','collapsible','animationType','enableScrollAnimation','contentTransitionDuration','toggleMode','selectedItem','position','selectionTracker','scrollable','scrollPosit... | [
"public",
"function",
"getWidgetOptions",
"(",
")",
"{",
"$",
"options",
"=",
"new",
"\\",
"stdClass",
";",
"foreach",
"(",
"array",
"(",
"'width'",
",",
"'height'",
",",
"'disabled'",
",",
"'scrollAnimationDuration'",
",",
"'enabledHover'",
",",
"'collapsible'"... | Gibt alle gesetzten Optionen des Widgets zurück
@return stdClass | [
"Gibt",
"alle",
"gesetzten",
"Optionen",
"des",
"Widgets",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/jqx/TabsSpecification.php#L495-L503 |
periaptio/empress-generator | src/Commands/ResourceMakeCommand.php | ResourceMakeCommand.handle | public function handle()
{
$params = [
'tables' => $this->argument('tables'),
'--tables' => $this->option('tables'),
'--ignore' => $this->option('ignore'),
];
$this->call('generator:make:migration', $params);
$params['--models'] = $this->option... | php | public function handle()
{
$params = [
'tables' => $this->argument('tables'),
'--tables' => $this->option('tables'),
'--ignore' => $this->option('ignore'),
];
$this->call('generator:make:migration', $params);
$params['--models'] = $this->option... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"params",
"=",
"[",
"'tables'",
"=>",
"$",
"this",
"->",
"argument",
"(",
"'tables'",
")",
",",
"'--tables'",
"=>",
"$",
"this",
"->",
"option",
"(",
"'tables'",
")",
",",
"'--ignore'",
"=>",
"$",
"... | Execute the command.
@return void | [
"Execute",
"the",
"command",
"."
] | train | https://github.com/periaptio/empress-generator/blob/749fb4b12755819e9c97377ebfb446ee0822168a/src/Commands/ResourceMakeCommand.php#L31-L46 |
Double-Opt-in/php-client-api | src/Client/Api.php | Api.resolveClient | private function resolveClient($client)
{
$client = ! empty($client)
? $client
: new Client();
$client->setBaseUrl(Properties::baseUrl())
->setUserAgent('Double Opt-in php-api/' . self::VERSION);
$httpClientConfig = $this->config->getHttpClientConfig();
if (array_key_exists('verify', $httpClientConf... | php | private function resolveClient($client)
{
$client = ! empty($client)
? $client
: new Client();
$client->setBaseUrl(Properties::baseUrl())
->setUserAgent('Double Opt-in php-api/' . self::VERSION);
$httpClientConfig = $this->config->getHttpClientConfig();
if (array_key_exists('verify', $httpClientConf... | [
"private",
"function",
"resolveClient",
"(",
"$",
"client",
")",
"{",
"$",
"client",
"=",
"!",
"empty",
"(",
"$",
"client",
")",
"?",
"$",
"client",
":",
"new",
"Client",
"(",
")",
";",
"$",
"client",
"->",
"setBaseUrl",
"(",
"Properties",
"::",
"bas... | resolves a http client
@param ClientInterface|null $client
@return ClientInterface|Client | [
"resolves",
"a",
"http",
"client"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Api.php#L84-L101 |
Double-Opt-in/php-client-api | src/Client/Api.php | Api.setupOAuth2Plugin | private function setupOAuth2Plugin()
{
$oauth2AuthorizationClient = $this->resolveClient(null);
$oauth2AuthorizationClient->setBaseUrl(Properties::authorizationUrl());
$clientCredentials = new ClientCredentials($oauth2AuthorizationClient, $this->config->toArray());
$oauth2Plugin = new OAuth2Plugin($clientCred... | php | private function setupOAuth2Plugin()
{
$oauth2AuthorizationClient = $this->resolveClient(null);
$oauth2AuthorizationClient->setBaseUrl(Properties::authorizationUrl());
$clientCredentials = new ClientCredentials($oauth2AuthorizationClient, $this->config->toArray());
$oauth2Plugin = new OAuth2Plugin($clientCred... | [
"private",
"function",
"setupOAuth2Plugin",
"(",
")",
"{",
"$",
"oauth2AuthorizationClient",
"=",
"$",
"this",
"->",
"resolveClient",
"(",
"null",
")",
";",
"$",
"oauth2AuthorizationClient",
"->",
"setBaseUrl",
"(",
"Properties",
"::",
"authorizationUrl",
"(",
")"... | setting up the oauth2 plugin for authorizing the requests | [
"setting",
"up",
"the",
"oauth2",
"plugin",
"for",
"authorizing",
"the",
"requests"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Api.php#L106-L116 |
Double-Opt-in/php-client-api | src/Client/Api.php | Api.send | public function send(ClientCommand $command)
{
$request = $this->client->createRequest(
$command->method(),
$this->client->getBaseUrl() . $command->uri($this->cryptographyEngine),
$this->headers($command->apiVersion(), $command->format(), $command->headers()),
$command->body($this->cryptographyEngine),
... | php | public function send(ClientCommand $command)
{
$request = $this->client->createRequest(
$command->method(),
$this->client->getBaseUrl() . $command->uri($this->cryptographyEngine),
$this->headers($command->apiVersion(), $command->format(), $command->headers()),
$command->body($this->cryptographyEngine),
... | [
"public",
"function",
"send",
"(",
"ClientCommand",
"$",
"command",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"client",
"->",
"createRequest",
"(",
"$",
"command",
"->",
"method",
"(",
")",
",",
"$",
"this",
"->",
"client",
"->",
"getBaseUrl",
... | get all actions
@param ClientCommand $command
@return Response|CommandResponse|DecryptedCommandResponse|StatusResponse | [
"get",
"all",
"actions"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Api.php#L125-L144 |
lode/fem | src/login_token.php | login_token.get_by_token | public static function get_by_token($token) {
$mysql = bootstrap::get_library('mysql');
$sql = "SELECT * FROM `login_tokens` WHERE `code` = '%s';";
$login = $mysql::select('row', $sql, $token);
if (empty($login)) {
return false;
}
return new static($login['id']);
} | php | public static function get_by_token($token) {
$mysql = bootstrap::get_library('mysql');
$sql = "SELECT * FROM `login_tokens` WHERE `code` = '%s';";
$login = $mysql::select('row', $sql, $token);
if (empty($login)) {
return false;
}
return new static($login['id']);
} | [
"public",
"static",
"function",
"get_by_token",
"(",
"$",
"token",
")",
"{",
"$",
"mysql",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'mysql'",
")",
";",
"$",
"sql",
"=",
"\"SELECT * FROM `login_tokens` WHERE `code` = '%s';\"",
";",
"$",
"login",
"=",
"$",
"... | checks whether the given token match one on file
@param string $token
@return $this|boolean false when the token is not found | [
"checks",
"whether",
"the",
"given",
"token",
"match",
"one",
"on",
"file"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_token.php#L80-L90 |
lode/fem | src/login_token.php | login_token.is_valid | public function is_valid($mark_as_used=true) {
if (!empty($this->data['used'])) {
return false;
}
if (time() > $this->data['expire_at']) {
return false;
}
if ($mark_as_used) {
$this->mark_as_used();
}
return true;
} | php | public function is_valid($mark_as_used=true) {
if (!empty($this->data['used'])) {
return false;
}
if (time() > $this->data['expire_at']) {
return false;
}
if ($mark_as_used) {
$this->mark_as_used();
}
return true;
} | [
"public",
"function",
"is_valid",
"(",
"$",
"mark_as_used",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"data",
"[",
"'used'",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"time",
"(",
")",
">",
"$",
"... | check if the token is still valid
also marks the token as used to prevent more people getting in
@param boolean $mark_as_used set to false to validate w/o user action
@return boolean | [
"check",
"if",
"the",
"token",
"is",
"still",
"valid",
"also",
"marks",
"the",
"token",
"as",
"used",
"to",
"prevent",
"more",
"people",
"getting",
"in"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_token.php#L99-L112 |
lode/fem | src/login_token.php | login_token.mark_as_used | public function mark_as_used() {
$mysql = bootstrap::get_library('mysql');
$sql = "UPDATE `login_tokens` SET `used` = 1, `last_used_at` = %d WHERE `id` = %d;";
$binds = [time(), $this->data['id']];
$mysql::query($sql, $binds);
} | php | public function mark_as_used() {
$mysql = bootstrap::get_library('mysql');
$sql = "UPDATE `login_tokens` SET `used` = 1, `last_used_at` = %d WHERE `id` = %d;";
$binds = [time(), $this->data['id']];
$mysql::query($sql, $binds);
} | [
"public",
"function",
"mark_as_used",
"(",
")",
"{",
"$",
"mysql",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'mysql'",
")",
";",
"$",
"sql",
"=",
"\"UPDATE `login_tokens` SET `used` = 1, `last_used_at` = %d WHERE `id` = %d;\"",
";",
"$",
"binds",
"=",
"[",
"time"... | prevents a token to be re-used
is usually called directly by ::is_valid()
@return void | [
"prevents",
"a",
"token",
"to",
"be",
"re",
"-",
"used",
"is",
"usually",
"called",
"directly",
"by",
"::",
"is_valid",
"()"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_token.php#L129-L135 |
lode/fem | src/login_token.php | login_token.create | public static function create($user_id) {
$text = bootstrap::get_library('text');
$mysql = bootstrap::get_library('mysql');
$new_token = $text::generate_token(self::TOKEN_LENGTH);
$expiration = (time() + self::EXPIRATION);
$sql = "INSERT INTO `login_tokens` SET `code` = '%s', `user_id` = %d, `expire_at` = ... | php | public static function create($user_id) {
$text = bootstrap::get_library('text');
$mysql = bootstrap::get_library('mysql');
$new_token = $text::generate_token(self::TOKEN_LENGTH);
$expiration = (time() + self::EXPIRATION);
$sql = "INSERT INTO `login_tokens` SET `code` = '%s', `user_id` = %d, `expire_at` = ... | [
"public",
"static",
"function",
"create",
"(",
"$",
"user_id",
")",
"{",
"$",
"text",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'text'",
")",
";",
"$",
"mysql",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'mysql'",
")",
";",
"$",
"new_token",
"=",
... | create a new temporary login token
@param int $user_id
@return $this | [
"create",
"a",
"new",
"temporary",
"login",
"token"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_token.php#L143-L155 |
2amigos/yiifoundation | helpers/Icon.php | Icon.icon | public static function icon($icon, $htmlOptions = array(), $tagName = 'i')
{
if (is_string($icon)) {
if (strpos($icon, 'foundicon-') === false) {
$icon = 'foundicon-' . implode(' foundicon-', array_unique(explode(' ', $icon)));
}
ArrayHelper::addValue('cla... | php | public static function icon($icon, $htmlOptions = array(), $tagName = 'i')
{
if (is_string($icon)) {
if (strpos($icon, 'foundicon-') === false) {
$icon = 'foundicon-' . implode(' foundicon-', array_unique(explode(' ', $icon)));
}
ArrayHelper::addValue('cla... | [
"public",
"static",
"function",
"icon",
"(",
"$",
"icon",
",",
"$",
"htmlOptions",
"=",
"array",
"(",
")",
",",
"$",
"tagName",
"=",
"'i'",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"icon",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"icon",
... | Generates an icon.
@param string $icon the icon type.
@param array $htmlOptions additional HTML attributes.
@param string $tagName the icon HTML tag.
@return string the generated icon. | [
"Generates",
"an",
"icon",
"."
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Icon.php#L28-L38 |
2amigos/yiifoundation | helpers/Icon.php | Icon.registerIconFontSet | public static function registerIconFontSet($fontName, $forceCopyAssets = false)
{
if (!in_array($fontName, static::getAvailableIconFontSets())) {
return false;
}
$fontPath = \Yii::getPathOfAlias('foundation.fonts.foundation_icons_' . $fontName);
$fontUrl = \Yii::app()->... | php | public static function registerIconFontSet($fontName, $forceCopyAssets = false)
{
if (!in_array($fontName, static::getAvailableIconFontSets())) {
return false;
}
$fontPath = \Yii::getPathOfAlias('foundation.fonts.foundation_icons_' . $fontName);
$fontUrl = \Yii::app()->... | [
"public",
"static",
"function",
"registerIconFontSet",
"(",
"$",
"fontName",
",",
"$",
"forceCopyAssets",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"fontName",
",",
"static",
"::",
"getAvailableIconFontSets",
"(",
")",
")",
")",
"{",
"r... | Registers a specific Icon Set. They are registered individually
@param $fontName
@param $forceCopyAssets
@return bool | [
"Registers",
"a",
"specific",
"Icon",
"Set",
".",
"They",
"are",
"registered",
"individually"
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Icon.php#L46-L60 |
phossa2/config | src/Config/Loader/ConfigFileLoader.php | ConfigFileLoader.load | public function load(
/*# string */ $group,
/*# string */ $environment = ''
)/*# : array */ {
$data = [];
$env = $environment ?: $this->environment;
foreach ($this->globFiles($group, $env) as $file) {
$grp = basename($file, '.' . $this->file_type);
i... | php | public function load(
/*# string */ $group,
/*# string */ $environment = ''
)/*# : array */ {
$data = [];
$env = $environment ?: $this->environment;
foreach ($this->globFiles($group, $env) as $file) {
$grp = basename($file, '.' . $this->file_type);
i... | [
"public",
"function",
"load",
"(",
"/*# string */",
"$",
"group",
",",
"/*# string */",
"$",
"environment",
"=",
"''",
")",
"/*# : array */",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"env",
"=",
"$",
"environment",
"?",
":",
"$",
"this",
"->",
"envir... | {@inheritDoc} | [
"{"
] | train | https://github.com/phossa2/config/blob/7c046fd2c97633b69545b4745d8bffe28e19b1df/src/Config/Loader/ConfigFileLoader.php#L91-L109 |
phossa2/config | src/Config/Loader/ConfigFileLoader.php | ConfigFileLoader.setRootDir | public function setRootDir(/*# string */ $rootDir)
{
$dir = realpath($rootDir);
if (false === $dir) {
throw new InvalidArgumentException(
Message::get(Message::CONFIG_ROOT_INVALID, $rootDir),
Message::CONFIG_ROOT_INVALID
);
}
... | php | public function setRootDir(/*# string */ $rootDir)
{
$dir = realpath($rootDir);
if (false === $dir) {
throw new InvalidArgumentException(
Message::get(Message::CONFIG_ROOT_INVALID, $rootDir),
Message::CONFIG_ROOT_INVALID
);
}
... | [
"public",
"function",
"setRootDir",
"(",
"/*# string */",
"$",
"rootDir",
")",
"{",
"$",
"dir",
"=",
"realpath",
"(",
"$",
"rootDir",
")",
";",
"if",
"(",
"false",
"===",
"$",
"dir",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"Message",
"... | Set config file root directory
@param string $rootDir
@return $this
@throws InvalidArgumentException if root dir is unknown
@access public
@api | [
"Set",
"config",
"file",
"root",
"directory"
] | train | https://github.com/phossa2/config/blob/7c046fd2c97633b69545b4745d8bffe28e19b1df/src/Config/Loader/ConfigFileLoader.php#L120-L134 |
phossa2/config | src/Config/Loader/ConfigFileLoader.php | ConfigFileLoader.setFileType | public function setFileType(/*# string */ $fileType)
{
if (!Reader::isSupported($fileType)) {
throw new InvalidArgumentException(
Message::get(Message::CONFIG_FILE_TYPE_UNKNOWN, $fileType),
Message::CONFIG_FILE_TYPE_UNKNOWN
);
}
$this-... | php | public function setFileType(/*# string */ $fileType)
{
if (!Reader::isSupported($fileType)) {
throw new InvalidArgumentException(
Message::get(Message::CONFIG_FILE_TYPE_UNKNOWN, $fileType),
Message::CONFIG_FILE_TYPE_UNKNOWN
);
}
$this-... | [
"public",
"function",
"setFileType",
"(",
"/*# string */",
"$",
"fileType",
")",
"{",
"if",
"(",
"!",
"Reader",
"::",
"isSupported",
"(",
"$",
"fileType",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"Message",
"::",
"get",
"(",
"Message",... | Set config file type
@param string $fileType
@return $this
@throws InvalidArgumentException if unsupported file type
@access public
@api | [
"Set",
"config",
"file",
"type"
] | train | https://github.com/phossa2/config/blob/7c046fd2c97633b69545b4745d8bffe28e19b1df/src/Config/Loader/ConfigFileLoader.php#L145-L156 |
phossa2/config | src/Config/Loader/ConfigFileLoader.php | ConfigFileLoader.globFiles | protected function globFiles(
/*# string */ $group,
/*# string */ $environment
)/*# : array */ {
$files = [];
$group = '' === $group ? '*' : $group;
foreach ($this->getSearchDirs($environment) as $dir) {
$file = $dir . $group . '.' . $this->file_type;
... | php | protected function globFiles(
/*# string */ $group,
/*# string */ $environment
)/*# : array */ {
$files = [];
$group = '' === $group ? '*' : $group;
foreach ($this->getSearchDirs($environment) as $dir) {
$file = $dir . $group . '.' . $this->file_type;
... | [
"protected",
"function",
"globFiles",
"(",
"/*# string */",
"$",
"group",
",",
"/*# string */",
"$",
"environment",
")",
"/*# : array */",
"{",
"$",
"files",
"=",
"[",
"]",
";",
"$",
"group",
"=",
"''",
"===",
"$",
"group",
"?",
"'*'",
":",
"$",
"group",... | Returns an array of files to read from
@param string $group
@param string $environment
@return array
@access protected | [
"Returns",
"an",
"array",
"of",
"files",
"to",
"read",
"from"
] | train | https://github.com/phossa2/config/blob/7c046fd2c97633b69545b4745d8bffe28e19b1df/src/Config/Loader/ConfigFileLoader.php#L181-L192 |
phossa2/config | src/Config/Loader/ConfigFileLoader.php | ConfigFileLoader.getSearchDirs | protected function getSearchDirs(/*# string */ $env)/*# : array */
{
if (!isset($this->sub_dirs[$env])) {
$this->sub_dirs[$env] = $this->buildSearchDirs($env);
}
return $this->sub_dirs[$env];
} | php | protected function getSearchDirs(/*# string */ $env)/*# : array */
{
if (!isset($this->sub_dirs[$env])) {
$this->sub_dirs[$env] = $this->buildSearchDirs($env);
}
return $this->sub_dirs[$env];
} | [
"protected",
"function",
"getSearchDirs",
"(",
"/*# string */",
"$",
"env",
")",
"/*# : array */",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"sub_dirs",
"[",
"$",
"env",
"]",
")",
")",
"{",
"$",
"this",
"->",
"sub_dirs",
"[",
"$",
"env",
... | Get the search directories
@param string $env
@return array
@access protected | [
"Get",
"the",
"search",
"directories"
] | train | https://github.com/phossa2/config/blob/7c046fd2c97633b69545b4745d8bffe28e19b1df/src/Config/Loader/ConfigFileLoader.php#L201-L207 |
phossa2/config | src/Config/Loader/ConfigFileLoader.php | ConfigFileLoader.buildSearchDirs | protected function buildSearchDirs(/*# string */ $env)/*# : array */
{
$path = $this->root_dir;
$part = preg_split(
'/[\/\\\]/',
trim($env, '/\\'),
0,
\PREG_SPLIT_NO_EMPTY
);
$subdirs = [$path];
foreach ($part as $dir) {
... | php | protected function buildSearchDirs(/*# string */ $env)/*# : array */
{
$path = $this->root_dir;
$part = preg_split(
'/[\/\\\]/',
trim($env, '/\\'),
0,
\PREG_SPLIT_NO_EMPTY
);
$subdirs = [$path];
foreach ($part as $dir) {
... | [
"protected",
"function",
"buildSearchDirs",
"(",
"/*# string */",
"$",
"env",
")",
"/*# : array */",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"root_dir",
";",
"$",
"part",
"=",
"preg_split",
"(",
"'/[\\/\\\\\\]/'",
",",
"trim",
"(",
"$",
"env",
",",
"'/\\... | Build search directories
@param string $env
@return array
@access protected | [
"Build",
"search",
"directories"
] | train | https://github.com/phossa2/config/blob/7c046fd2c97633b69545b4745d8bffe28e19b1df/src/Config/Loader/ConfigFileLoader.php#L216-L238 |
spiral-modules/scaffolder | source/Scaffolder/Declarations/ControllerDeclaration.php | ControllerDeclaration.addAction | public function addAction(string $action): ClassDeclaration\MethodDeclaration
{
$method = $this->method($action . $this->actionPostfix);
return $method->setAccess(ClassDeclaration\MethodDeclaration::ACCESS_PROTECTED);
} | php | public function addAction(string $action): ClassDeclaration\MethodDeclaration
{
$method = $this->method($action . $this->actionPostfix);
return $method->setAccess(ClassDeclaration\MethodDeclaration::ACCESS_PROTECTED);
} | [
"public",
"function",
"addAction",
"(",
"string",
"$",
"action",
")",
":",
"ClassDeclaration",
"\\",
"MethodDeclaration",
"{",
"$",
"method",
"=",
"$",
"this",
"->",
"method",
"(",
"$",
"action",
".",
"$",
"this",
"->",
"actionPostfix",
")",
";",
"return",... | @param string $action
@return ClassDeclaration\MethodDeclaration | [
"@param",
"string",
"$action"
] | train | https://github.com/spiral-modules/scaffolder/blob/9be9dd0da6e4b02232db24e797fe5c288afbbddf/source/Scaffolder/Declarations/ControllerDeclaration.php#L47-L52 |
ConnectHolland/tulip-api-client | src/Client.php | Client.getServiceUrl | public function getServiceUrl($serviceName, $action)
{
return sprintf('%s/api/%s/%s/%s', $this->tulipUrl, $this->apiVersion, $serviceName, $action);
} | php | public function getServiceUrl($serviceName, $action)
{
return sprintf('%s/api/%s/%s/%s', $this->tulipUrl, $this->apiVersion, $serviceName, $action);
} | [
"public",
"function",
"getServiceUrl",
"(",
"$",
"serviceName",
",",
"$",
"action",
")",
"{",
"return",
"sprintf",
"(",
"'%s/api/%s/%s/%s'",
",",
"$",
"this",
"->",
"tulipUrl",
",",
"$",
"this",
"->",
"apiVersion",
",",
"$",
"serviceName",
",",
"$",
"actio... | Returns the full Tulip API URL for the specified service and action.
@param string $serviceName
@param string $action
@return string | [
"Returns",
"the",
"full",
"Tulip",
"API",
"URL",
"for",
"the",
"specified",
"service",
"and",
"action",
"."
] | train | https://github.com/ConnectHolland/tulip-api-client/blob/641325e2d57c1c272ede7fd8b47d4f2b67b73507/src/Client.php#L85-L88 |
ConnectHolland/tulip-api-client | src/Client.php | Client.callService | public function callService($serviceName, $action, array $parameters = array(), array $files = array())
{
$httpClient = $this->getHTTPClient();
$url = $this->getServiceUrl($serviceName, $action);
$request = new Request('POST', $url, $this->getRequestHeaders($url, $parameters), $this->getReq... | php | public function callService($serviceName, $action, array $parameters = array(), array $files = array())
{
$httpClient = $this->getHTTPClient();
$url = $this->getServiceUrl($serviceName, $action);
$request = new Request('POST', $url, $this->getRequestHeaders($url, $parameters), $this->getReq... | [
"public",
"function",
"callService",
"(",
"$",
"serviceName",
",",
"$",
"action",
",",
"array",
"$",
"parameters",
"=",
"array",
"(",
")",
",",
"array",
"$",
"files",
"=",
"array",
"(",
")",
")",
"{",
"$",
"httpClient",
"=",
"$",
"this",
"->",
"getHT... | Call a Tulip API service.
@param string $serviceName
@param string $action
@param array $parameters
@param array $files
@return ResponseInterface
@throws RequestException | [
"Call",
"a",
"Tulip",
"API",
"service",
"."
] | train | https://github.com/ConnectHolland/tulip-api-client/blob/641325e2d57c1c272ede7fd8b47d4f2b67b73507/src/Client.php#L112-L128 |
ConnectHolland/tulip-api-client | src/Client.php | Client.getHTTPClient | private function getHTTPClient()
{
if ($this->httpClient instanceof ClientInterface === false) {
$this->httpClient = new HTTPClient();
}
return $this->httpClient;
} | php | private function getHTTPClient()
{
if ($this->httpClient instanceof ClientInterface === false) {
$this->httpClient = new HTTPClient();
}
return $this->httpClient;
} | [
"private",
"function",
"getHTTPClient",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"httpClient",
"instanceof",
"ClientInterface",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"httpClient",
"=",
"new",
"HTTPClient",
"(",
")",
";",
"}",
"return",
"$",
"t... | Returns a ClientInterface instance.
@return ClientInterface | [
"Returns",
"a",
"ClientInterface",
"instance",
"."
] | train | https://github.com/ConnectHolland/tulip-api-client/blob/641325e2d57c1c272ede7fd8b47d4f2b67b73507/src/Client.php#L135-L142 |
ConnectHolland/tulip-api-client | src/Client.php | Client.getRequestHeaders | private function getRequestHeaders($url, array $parameters)
{
$headers = array();
if (isset($this->clientId) && isset($this->sharedSecret)) {
$objectIdentifier = null;
if ($this->apiVersion === '1.1' && isset($parameters['id'])) {
$objectIdentifier = $paramet... | php | private function getRequestHeaders($url, array $parameters)
{
$headers = array();
if (isset($this->clientId) && isset($this->sharedSecret)) {
$objectIdentifier = null;
if ($this->apiVersion === '1.1' && isset($parameters['id'])) {
$objectIdentifier = $paramet... | [
"private",
"function",
"getRequestHeaders",
"(",
"$",
"url",
",",
"array",
"$",
"parameters",
")",
"{",
"$",
"headers",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"clientId",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
... | Returns the request authentication headers when a client ID and shared secret are provided.
@param string $url
@param array $parameters
@return array | [
"Returns",
"the",
"request",
"authentication",
"headers",
"when",
"a",
"client",
"ID",
"and",
"shared",
"secret",
"are",
"provided",
"."
] | train | https://github.com/ConnectHolland/tulip-api-client/blob/641325e2d57c1c272ede7fd8b47d4f2b67b73507/src/Client.php#L152-L169 |
ConnectHolland/tulip-api-client | src/Client.php | Client.getRequestBody | private function getRequestBody(array $parameters, array $files)
{
$body = array();
foreach ($parameters as $parameterName => $parameterValue) {
if (is_scalar($parameterValue) || (is_null($parameterValue) && $parameterName !== 'id')) {
$body[] = array(
... | php | private function getRequestBody(array $parameters, array $files)
{
$body = array();
foreach ($parameters as $parameterName => $parameterValue) {
if (is_scalar($parameterValue) || (is_null($parameterValue) && $parameterName !== 'id')) {
$body[] = array(
... | [
"private",
"function",
"getRequestBody",
"(",
"array",
"$",
"parameters",
",",
"array",
"$",
"files",
")",
"{",
"$",
"body",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"parameterName",
"=>",
"$",
"parameterValue",
")",
"{"... | Returns the multipart request body with the parameters and files.
@param array $parameters
@param array $files
@return MultipartStream | [
"Returns",
"the",
"multipart",
"request",
"body",
"with",
"the",
"parameters",
"and",
"files",
"."
] | train | https://github.com/ConnectHolland/tulip-api-client/blob/641325e2d57c1c272ede7fd8b47d4f2b67b73507/src/Client.php#L179-L204 |
ConnectHolland/tulip-api-client | src/Client.php | Client.validateAPIResponseCode | private function validateAPIResponseCode(RequestInterface $request, ResponseInterface $response)
{
$responseParser = new ResponseParser($response);
switch ($responseParser->getResponseCode()) {
case ResponseCodes::SUCCESS:
break;
case ResponseCodes::NOT_AUTHOR... | php | private function validateAPIResponseCode(RequestInterface $request, ResponseInterface $response)
{
$responseParser = new ResponseParser($response);
switch ($responseParser->getResponseCode()) {
case ResponseCodes::SUCCESS:
break;
case ResponseCodes::NOT_AUTHOR... | [
"private",
"function",
"validateAPIResponseCode",
"(",
"RequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"responseParser",
"=",
"new",
"ResponseParser",
"(",
"$",
"response",
")",
";",
"switch",
"(",
"$",
"responseParser... | Validates the Tulip API response code.
@param RequestInterface $request
@param ResponseInterface $response
@throws NotAuthorizedException when not authenticated / authorized correctly.
@throws UnknownServiceException when the called API service is not found within the Tulip API.
@throws ParametersRequiredEx... | [
"Validates",
"the",
"Tulip",
"API",
"response",
"code",
"."
] | train | https://github.com/ConnectHolland/tulip-api-client/blob/641325e2d57c1c272ede7fd8b47d4f2b67b73507/src/Client.php#L218-L236 |
webforge-labs/psc-cms | lib/Psc/Data/Set.php | Set.get | public function get($field) {
// wir machen hier erstmal nicht so performant immer einen meta-check
$this->meta->getFieldType($field); // throws FieldNotDefinedException
return $this->fields->get($field, NULL, NULL); // returned immer NULL wenn nicht gesetzt
} | php | public function get($field) {
// wir machen hier erstmal nicht so performant immer einen meta-check
$this->meta->getFieldType($field); // throws FieldNotDefinedException
return $this->fields->get($field, NULL, NULL); // returned immer NULL wenn nicht gesetzt
} | [
"public",
"function",
"get",
"(",
"$",
"field",
")",
"{",
"// wir machen hier erstmal nicht so performant immer einen meta-check",
"$",
"this",
"->",
"meta",
"->",
"getFieldType",
"(",
"$",
"field",
")",
";",
"// throws FieldNotDefinedException",
"return",
"$",
"this",
... | Gibt die Daten für das Feld zurück
ist das Feld in Meta definiert, aber keine Daten gesetzt worden wird NULL zurückgegeben
@param array|string wenn string dann ebenen mit . getrennt
@return mixed|NULL
@throws FieldNotDefinedException | [
"Gibt",
"die",
"Daten",
"für",
"das",
"Feld",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/Set.php#L43-L48 |
webforge-labs/psc-cms | lib/Psc/Data/Set.php | Set.setFieldsFromArray | public function setFieldsFromArray(Array $fields) {
foreach ($fields as $field => $value) {
$this->set($field, $value);
}
return $this;
} | php | public function setFieldsFromArray(Array $fields) {
foreach ($fields as $field => $value) {
$this->set($field, $value);
}
return $this;
} | [
"public",
"function",
"setFieldsFromArray",
"(",
"Array",
"$",
"fields",
")",
"{",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"field",
",",
"$",
"value",
")",
";",
"}",
"retu... | Setzt mehrere Felder aus einem Array
die Felder die als Schlüssel angegeben werden, müssen alle als Meta existieren
@param array $fields Schlüssel sind mit . getrennte strings Werte sind die Werte der Felder | [
"Setzt",
"mehrere",
"Felder",
"aus",
"einem",
"Array"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/Set.php#L112-L117 |
webforge-labs/psc-cms | lib/Psc/Data/Set.php | Set.getWalkableFields | public function getWalkableFields() {
$fields = array();
// hier so umständlich, weil meta->getTypes() uns die fields "geflattet" zurückgibt (und das wollen wir)
foreach ($this->meta->getTypes() as $field => $type) {
$fields[$field] = $this->get($field);
}
return $fields;
} | php | public function getWalkableFields() {
$fields = array();
// hier so umständlich, weil meta->getTypes() uns die fields "geflattet" zurückgibt (und das wollen wir)
foreach ($this->meta->getTypes() as $field => $type) {
$fields[$field] = $this->get($field);
}
return $fields;
} | [
"public",
"function",
"getWalkableFields",
"(",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
")",
";",
"// hier so umständlich, weil meta->getTypes() uns die fields \"geflattet\" zurückgibt (und das wollen wir)",
"foreach",
"(",
"$",
"this",
"->",
"meta",
"->",
"getTypes",
... | /* INTERFACE: Walkable | [
"/",
"*",
"INTERFACE",
":",
"Walkable"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/Set.php#L142-L149 |
webforge-labs/psc-cms | lib/Psc/Data/Set.php | Set.createFromStruct | public static function createFromStruct(Array $struct, SetMeta $meta = NULL) {
if (!isset($meta)) $meta = new SetMeta();
$set = new static(array(), $meta);
foreach ($struct as $field => $list) {
list($value, $type) = $list;
$set->set($field, $value, $type);
}
return $set;
} | php | public static function createFromStruct(Array $struct, SetMeta $meta = NULL) {
if (!isset($meta)) $meta = new SetMeta();
$set = new static(array(), $meta);
foreach ($struct as $field => $list) {
list($value, $type) = $list;
$set->set($field, $value, $type);
}
return $set;
} | [
"public",
"static",
"function",
"createFromStruct",
"(",
"Array",
"$",
"struct",
",",
"SetMeta",
"$",
"meta",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"meta",
")",
")",
"$",
"meta",
"=",
"new",
"SetMeta",
"(",
")",
";",
"$",
"set",... | Erstellt ein Set mit angegebenen Metadaten
Shortcoming um die Felder des Sets nicht doppelt bezeichnen zu müssen
struct ist ein Array von Listen mit jeweils genau 2 elementen (key 0 und key 1)
@param list[] $struct die Listen sind von der Form: list(mixed $fieldValue, Webforge\Types\Type $fieldType). Die Schlüssel si... | [
"Erstellt",
"ein",
"Set",
"mit",
"angegebenen",
"Metadaten"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/Set.php#L166-L176 |
zodream/thirdparty | src/OAuth/TaoBao.php | TaoBao.info | public function info() {
$this->identity = $this->get('taobao_user_id');
$this->username = urldecode($this->get('taobao_user_nick'));
return $this->get();
} | php | public function info() {
$this->identity = $this->get('taobao_user_id');
$this->username = urldecode($this->get('taobao_user_nick'));
return $this->get();
} | [
"public",
"function",
"info",
"(",
")",
"{",
"$",
"this",
"->",
"identity",
"=",
"$",
"this",
"->",
"get",
"(",
"'taobao_user_id'",
")",
";",
"$",
"this",
"->",
"username",
"=",
"urldecode",
"(",
"$",
"this",
"->",
"get",
"(",
"'taobao_user_nick'",
")"... | 获取用户信息
@return array | [
"获取用户信息"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/OAuth/TaoBao.php#L99-L103 |
mihai-stancu/serializer | Serializer/Normalizer/ParamsDenormalizer.php | ParamsDenormalizer.denormalize | public function denormalize($data, $class, $format = null, array $context = array())
{
/** @var \ReflectionParameter[] $params */
$params = $context['params'];
$indexBy = isset($context['indexBy']) ? $context['indexBy'] : 'name';
$arguments = [];
foreach ($params as $param) ... | php | public function denormalize($data, $class, $format = null, array $context = array())
{
/** @var \ReflectionParameter[] $params */
$params = $context['params'];
$indexBy = isset($context['indexBy']) ? $context['indexBy'] : 'name';
$arguments = [];
foreach ($params as $param) ... | [
"public",
"function",
"denormalize",
"(",
"$",
"data",
",",
"$",
"class",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"/** @var \\ReflectionParameter[] $params */",
"$",
"params",
"=",
"$",
"context",
"[... | @param array $data
@param string $class
@param string $format
@param array $context
@return array | [
"@param",
"array",
"$data",
"@param",
"string",
"$class",
"@param",
"string",
"$format",
"@param",
"array",
"$context"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/ParamsDenormalizer.php#L31-L55 |
mihai-stancu/serializer | Serializer/Normalizer/ParamsDenormalizer.php | ParamsDenormalizer.denormalizeParam | protected function denormalizeParam($data, $param, $format, $context)
{
$name = $param->getName();
$index = $param->getPosition();
if (array_key_exists($name, $data)) {
$value = $data[$name];
} elseif (array_key_exists($index, $data)) {
$value = $data[$index]... | php | protected function denormalizeParam($data, $param, $format, $context)
{
$name = $param->getName();
$index = $param->getPosition();
if (array_key_exists($name, $data)) {
$value = $data[$name];
} elseif (array_key_exists($index, $data)) {
$value = $data[$index]... | [
"protected",
"function",
"denormalizeParam",
"(",
"$",
"data",
",",
"$",
"param",
",",
"$",
"format",
",",
"$",
"context",
")",
"{",
"$",
"name",
"=",
"$",
"param",
"->",
"getName",
"(",
")",
";",
"$",
"index",
"=",
"$",
"param",
"->",
"getPosition",... | @param array $data
@param \ReflectionParameter $param
@param string $format
@param array $context
@return object | [
"@param",
"array",
"$data",
"@param",
"\\",
"ReflectionParameter",
"$param",
"@param",
"string",
"$format",
"@param",
"array",
"$context"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/ParamsDenormalizer.php#L65-L92 |
webforge-labs/psc-cms | lib/Psc/PHP/Lexer.php | Lexer.init | public function init($source) {
$this->source = $source; // für debug
$this->scan($source);
$this->reset();
} | php | public function init($source) {
$this->source = $source; // für debug
$this->scan($source);
$this->reset();
} | [
"public",
"function",
"init",
"(",
"$",
"source",
")",
"{",
"$",
"this",
"->",
"source",
"=",
"$",
"source",
";",
"// für debug",
"$",
"this",
"->",
"scan",
"(",
"$",
"source",
")",
";",
"$",
"this",
"->",
"reset",
"(",
")",
";",
"}"
] | Initialisiert den Lexer
der Sourcecode wird gelesen und in tokens übersetzt
nach diesem Befehl ist der erste token in $this->token gesetzt | [
"Initialisiert",
"den",
"Lexer"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/PHP/Lexer.php#L114-L118 |
webforge-labs/psc-cms | lib/Psc/PHP/Lexer.php | Lexer.moveNext | public function moveNext() {
$this->token = NULL;
/* wir könnten zwar auch token = lookahead machen (aus performance gründen), dies ist aber nicht so
gut wenn skipTokens umgesetzt werden, oder die Funktion aus reset() aufgerufen wird. Bei reset() müssten wir
dann diesen Programmcode hier duplizie... | php | public function moveNext() {
$this->token = NULL;
/* wir könnten zwar auch token = lookahead machen (aus performance gründen), dies ist aber nicht so
gut wenn skipTokens umgesetzt werden, oder die Funktion aus reset() aufgerufen wird. Bei reset() müssten wir
dann diesen Programmcode hier duplizie... | [
"public",
"function",
"moveNext",
"(",
")",
"{",
"$",
"this",
"->",
"token",
"=",
"NULL",
";",
"/* wir könnten zwar auch token = lookahead machen (aus performance gründen), dies ist aber nicht so\n gut wenn skipTokens umgesetzt werden, oder die Funktion aus reset() aufgerufen wird. ... | Bewegt den Cursor auf die den nächsten Token
Der nächste Token wird in lookahead gespeichert (letzten Token ist dieser dann === NULL)
der aktuelle Token ist in token
Gibt TRUE zurueck wenn noch ein weiteres mal moveNext() ausgeführt werden kann
@return bool | [
"Bewegt",
"den",
"Cursor",
"auf",
"die",
"den",
"nächsten",
"Token"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/PHP/Lexer.php#L264-L287 |
webforge-labs/psc-cms | lib/Psc/PHP/Lexer.php | Lexer.skipUntil | public function skipUntil($type) {
while (!$this->isToken($type) && $this->hasNext()) {
$this->moveNext();
}
return $this;
} | php | public function skipUntil($type) {
while (!$this->isToken($type) && $this->hasNext()) {
$this->moveNext();
}
return $this;
} | [
"public",
"function",
"skipUntil",
"(",
"$",
"type",
")",
"{",
"while",
"(",
"!",
"$",
"this",
"->",
"isToken",
"(",
"$",
"type",
")",
"&&",
"$",
"this",
"->",
"hasNext",
"(",
")",
")",
"{",
"$",
"this",
"->",
"moveNext",
"(",
")",
";",
"}",
"r... | Bewegt den Cursor auf den nächsten Token mit angegebem Typ
@chainable | [
"Bewegt",
"den",
"Cursor",
"auf",
"den",
"nächsten",
"Token",
"mit",
"angegebem",
"Typ"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/PHP/Lexer.php#L322-L328 |
webforge-labs/psc-cms | lib/Psc/PHP/Lexer.php | Lexer.reset | public function reset() {
$this->token = NULL;
$this->lookahead = NULL;
$this->position = -1;
$this->moveNext();
} | php | public function reset() {
$this->token = NULL;
$this->lookahead = NULL;
$this->position = -1;
$this->moveNext();
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"token",
"=",
"NULL",
";",
"$",
"this",
"->",
"lookahead",
"=",
"NULL",
";",
"$",
"this",
"->",
"position",
"=",
"-",
"1",
";",
"$",
"this",
"->",
"moveNext",
"(",
")",
";",
"}"
] | Setzt die Position auf den Anfang zurück | [
"Setzt",
"die",
"Position",
"auf",
"den",
"Anfang",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/PHP/Lexer.php#L420-L426 |
webforge-labs/psc-cms | lib/Psc/Doctrine/EntityRepository.php | EntityRepository.save | public function save(Entity $entity) {
$this->_em->persist($entity);
$this->_em->flush();
return $this;
} | php | public function save(Entity $entity) {
$this->_em->persist($entity);
$this->_em->flush();
return $this;
} | [
"public",
"function",
"save",
"(",
"Entity",
"$",
"entity",
")",
"{",
"$",
"this",
"->",
"_em",
"->",
"persist",
"(",
"$",
"entity",
")",
";",
"$",
"this",
"->",
"_em",
"->",
"flush",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Persisted das Entity und flushed den EntityManager | [
"Persisted",
"das",
"Entity",
"und",
"flushed",
"den",
"EntityManager"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/EntityRepository.php#L40-L44 |
webforge-labs/psc-cms | lib/Psc/Doctrine/EntityRepository.php | EntityRepository.remove | public function remove(Entity $entity) {
if (method_exists($entity,'remove')) {
$entity->remove();
}
$this->_em->remove($entity);
return $this;
} | php | public function remove(Entity $entity) {
if (method_exists($entity,'remove')) {
$entity->remove();
}
$this->_em->remove($entity);
return $this;
} | [
"public",
"function",
"remove",
"(",
"Entity",
"$",
"entity",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"entity",
",",
"'remove'",
")",
")",
"{",
"$",
"entity",
"->",
"remove",
"(",
")",
";",
"}",
"$",
"this",
"->",
"_em",
"->",
"remove",
"("... | Ruft auch remove() auf dem Entity auf, wenn die Funktion existiert
@ducktyped
ruft keinen flush auf | [
"Ruft",
"auch",
"remove",
"()",
"auf",
"dem",
"Entity",
"auf",
"wenn",
"die",
"Funktion",
"existiert"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/EntityRepository.php#L57-L64 |
webforge-labs/psc-cms | lib/Psc/Doctrine/EntityRepository.php | EntityRepository.delete | public function delete(Entity $entity) {
$this->remove($entity);
$this->_em->flush();
return $this;
} | php | public function delete(Entity $entity) {
$this->remove($entity);
$this->_em->flush();
return $this;
} | [
"public",
"function",
"delete",
"(",
"Entity",
"$",
"entity",
")",
"{",
"$",
"this",
"->",
"remove",
"(",
"$",
"entity",
")",
";",
"$",
"this",
"->",
"_em",
"->",
"flush",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Ruft auch remove() auf dem Entity auf, wenn die Funktion existiert
@ducktyped
ruft direkt flush auf | [
"Ruft",
"auch",
"remove",
"()",
"auf",
"dem",
"Entity",
"auf",
"wenn",
"die",
"Funktion",
"existiert"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/EntityRepository.php#L72-L77 |
webforge-labs/psc-cms | lib/Psc/Doctrine/EntityRepository.php | EntityRepository.hydrate | public function hydrate($identifier) {
$entity = $this->find($identifier);
if (!($entity instanceof $this->_entityName)) {
throw new EntityNotFoundException(
sprintf("Entity: '%s' nicht gefunden: identifier: %s",
$this->_entityName, Code::varInfo($identifier)));
}
... | php | public function hydrate($identifier) {
$entity = $this->find($identifier);
if (!($entity instanceof $this->_entityName)) {
throw new EntityNotFoundException(
sprintf("Entity: '%s' nicht gefunden: identifier: %s",
$this->_entityName, Code::varInfo($identifier)));
}
... | [
"public",
"function",
"hydrate",
"(",
"$",
"identifier",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"identifier",
")",
";",
"if",
"(",
"!",
"(",
"$",
"entity",
"instanceof",
"$",
"this",
"->",
"_entityName",
")",
")",
"{",
"... | Sowie find() aber mit Exception, erwartet nur ein Ergebnis
@throws \Psc\Doctrine\EntityNotFoundException
@TODO was passiert hier bei uneindeutigkeit? | [
"Sowie",
"find",
"()",
"aber",
"mit",
"Exception",
"erwartet",
"nur",
"ein",
"Ergebnis"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/EntityRepository.php#L86-L96 |
webforge-labs/psc-cms | lib/Psc/Doctrine/EntityRepository.php | EntityRepository.hydrateRole | public function hydrateRole($role, $identifier) {
return $this->_em->getRepository($this->_class->namespace.'\\'.ucfirst($role))->hydrate($identifier);
} | php | public function hydrateRole($role, $identifier) {
return $this->_em->getRepository($this->_class->namespace.'\\'.ucfirst($role))->hydrate($identifier);
} | [
"public",
"function",
"hydrateRole",
"(",
"$",
"role",
",",
"$",
"identifier",
")",
"{",
"return",
"$",
"this",
"->",
"_em",
"->",
"getRepository",
"(",
"$",
"this",
"->",
"_class",
"->",
"namespace",
".",
"'\\\\'",
".",
"ucfirst",
"(",
"$",
"role",
")... | Returns an entity of the project, which implements a specific Psc\CMS\Role
@return Psc\CMS\Role\$role.toCamelCase() | [
"Returns",
"an",
"entity",
"of",
"the",
"project",
"which",
"implements",
"a",
"specific",
"Psc",
"\\",
"CMS",
"\\",
"Role"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/EntityRepository.php#L104-L106 |
webforge-labs/psc-cms | lib/Psc/Doctrine/EntityRepository.php | EntityRepository.findOneByCriterias | public function findOneByCriterias(Array $criterias) {
foreach ($criterias as $criteria) {
try {
if (!is_array($criteria)) throw new \InvalidArgumentException('Elemente von $criterias müssen Arrays sein. '.Code::varInfo($criterias));
$object = $this->findOneBy($criteria);
... | php | public function findOneByCriterias(Array $criterias) {
foreach ($criterias as $criteria) {
try {
if (!is_array($criteria)) throw new \InvalidArgumentException('Elemente von $criterias müssen Arrays sein. '.Code::varInfo($criterias));
$object = $this->findOneBy($criteria);
... | [
"public",
"function",
"findOneByCriterias",
"(",
"Array",
"$",
"criterias",
")",
"{",
"foreach",
"(",
"$",
"criterias",
"as",
"$",
"criteria",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"criteria",
")",
")",
"throw",
"new",
"\\",
"Inva... | Prüft nach und nach in allen $criteria-Arrays in $criterias nach einem Vorkommen in diesem Repository
wird keins gefunden, wird eine Doctrine\ORM\NoResultException geworden
@throws Doctrine\ORM\NoResultException | [
"Prüft",
"nach",
"und",
"nach",
"in",
"allen",
"$criteria",
"-",
"Arrays",
"in",
"$criterias",
"nach",
"einem",
"Vorkommen",
"in",
"diesem",
"Repository"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/EntityRepository.php#L115-L128 |
webforge-labs/psc-cms | lib/Psc/Doctrine/EntityRepository.php | EntityRepository.hydrateBy | public function hydrateBy(array $criterias) {
$entity = $this->findOneBy($criterias);
if (!($entity instanceof $this->_entityName)) {
throw new EntityNotFoundException(sprintf('Entity %s nicht gefunden: criterias: %s', $this->_entityName, Code::varInfo($criterias)));
}
return $ent... | php | public function hydrateBy(array $criterias) {
$entity = $this->findOneBy($criterias);
if (!($entity instanceof $this->_entityName)) {
throw new EntityNotFoundException(sprintf('Entity %s nicht gefunden: criterias: %s', $this->_entityName, Code::varInfo($criterias)));
}
return $ent... | [
"public",
"function",
"hydrateBy",
"(",
"array",
"$",
"criterias",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"findOneBy",
"(",
"$",
"criterias",
")",
";",
"if",
"(",
"!",
"(",
"$",
"entity",
"instanceof",
"$",
"this",
"->",
"_entityName",
")",
... | Sowie findOneBy aber mit exception
@throws \Psc\Exception | [
"Sowie",
"findOneBy",
"aber",
"mit",
"exception"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/EntityRepository.php#L135-L143 |
webforge-labs/psc-cms | lib/Psc/Doctrine/EntityRepository.php | EntityRepository.autoCompleteTerm | public function autoCompleteTerm(Array $fields, $term = NULL, Array $filters = array(), $maxResults = NULL) {
$qb = $this->buildQueryAutoCompleteTerm($fields, $term);
$q = $qb->getQuery();
if ($maxResults) {
$q->setMaxResults($maxResults);
}
return $q->getResult();
} | php | public function autoCompleteTerm(Array $fields, $term = NULL, Array $filters = array(), $maxResults = NULL) {
$qb = $this->buildQueryAutoCompleteTerm($fields, $term);
$q = $qb->getQuery();
if ($maxResults) {
$q->setMaxResults($maxResults);
}
return $q->getResult();
} | [
"public",
"function",
"autoCompleteTerm",
"(",
"Array",
"$",
"fields",
",",
"$",
"term",
"=",
"NULL",
",",
"Array",
"$",
"filters",
"=",
"array",
"(",
")",
",",
"$",
"maxResults",
"=",
"NULL",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"buildQueryA... | @param $field das Feld auf welches der $term untersucht werden soll
ist Term nicht gesetzt werden alle Elemente zurückgegeben
$filters können zusätzliche filter sein (für ableitende klassen)
achtung! Vorsicht beim Ableiten mit JOINS von Autocomplete term und maxresults | [
"@param",
"$field",
"das",
"Feld",
"auf",
"welches",
"der",
"$term",
"untersucht",
"werden",
"soll",
"ist",
"Term",
"nicht",
"gesetzt",
"werden",
"alle",
"Elemente",
"zurückgegeben"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/EntityRepository.php#L166-L176 |
webforge-labs/psc-cms | lib/Psc/Doctrine/EntityRepository.php | EntityRepository.configureUniqueConstraintValidator | public function configureUniqueConstraintValidator(UniqueConstraintValidator $validator = NULL) {
$uniqueConstraints = $this->getUniqueConstraints();
if (!isset($validator)) {
// erstelle einen neuen
$constraint = array_shift($uniqueConstraints);
$validator = new UniqueConstraintVal... | php | public function configureUniqueConstraintValidator(UniqueConstraintValidator $validator = NULL) {
$uniqueConstraints = $this->getUniqueConstraints();
if (!isset($validator)) {
// erstelle einen neuen
$constraint = array_shift($uniqueConstraints);
$validator = new UniqueConstraintVal... | [
"public",
"function",
"configureUniqueConstraintValidator",
"(",
"UniqueConstraintValidator",
"$",
"validator",
"=",
"NULL",
")",
"{",
"$",
"uniqueConstraints",
"=",
"$",
"this",
"->",
"getUniqueConstraints",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"va... | Setzt einen UniqueConstraintValidator mit den passenden UniqueConstraints des Entities
sind keine Unique-Constraints für diese Klasse gesetzt, wird eine \Psc\Doctrine\NoUniqueConstraintException geworfen
@throws Psc\Doctrine\UniqueConstraintException, wenn $this->getUniqueIndex() einen inkonsistenten Index zurückgibt ... | [
"Setzt",
"einen",
"UniqueConstraintValidator",
"mit",
"den",
"passenden",
"UniqueConstraints",
"des",
"Entities"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/EntityRepository.php#L222-L242 |
webforge-labs/psc-cms | lib/Psc/Doctrine/EntityRepository.php | EntityRepository.deliverQuery | public function deliverQuery($queryBuilder, $qbFunction, $returnDefault) {
$qbFunction = $this->compileQBFunction($qbFunction);
$return = $qbFunction($queryBuilder) ?: $returnDefault;
if ($queryBuilder instanceof \Doctrine\ORM\QueryBuilder) {
$query = $queryBuilder->getQuery();
} ... | php | public function deliverQuery($queryBuilder, $qbFunction, $returnDefault) {
$qbFunction = $this->compileQBFunction($qbFunction);
$return = $qbFunction($queryBuilder) ?: $returnDefault;
if ($queryBuilder instanceof \Doctrine\ORM\QueryBuilder) {
$query = $queryBuilder->getQuery();
} ... | [
"public",
"function",
"deliverQuery",
"(",
"$",
"queryBuilder",
",",
"$",
"qbFunction",
",",
"$",
"returnDefault",
")",
"{",
"$",
"qbFunction",
"=",
"$",
"this",
"->",
"compileQBFunction",
"(",
"$",
"qbFunction",
")",
";",
"$",
"return",
"=",
"$",
"qbFunct... | Ruft den qbFunction-Hook auf dem QueryBuilder auf und gibt entsprechend ein Result oder den QueryBuilder zurück
der Hook kann unterbrechen, dass das Query direkt ausgeführt wird (return) oder bestimmen in welcher Form das Result zurückgegeben werden soll
die qbFunction kann folgende Strings zurückgeben umn das Verhal... | [
"Ruft",
"den",
"qbFunction",
"-",
"Hook",
"auf",
"dem",
"QueryBuilder",
"auf",
"und",
"gibt",
"entsprechend",
"ein",
"Result",
"oder",
"den",
"QueryBuilder",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/EntityRepository.php#L317-L359 |
davidgorges/color-contrast-php | src/ColorContrast.php | ColorContrast.addColors | public function addColors($colors)
{
$args = func_get_args();
foreach ($args as $arg) {
if (is_array($arg)) {
foreach ($arg as $color) {
$this->addColor($color);
}
} else {
$this->addColor($arg);
... | php | public function addColors($colors)
{
$args = func_get_args();
foreach ($args as $arg) {
if (is_array($arg)) {
foreach ($arg as $color) {
$this->addColor($color);
}
} else {
$this->addColor($arg);
... | [
"public",
"function",
"addColors",
"(",
"$",
"colors",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"arg",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"arg",
")",
")",
"{",
"foreach",
"(",
"$"... | add
@param mixed $colors | [
"add"
] | train | https://github.com/davidgorges/color-contrast-php/blob/11edc6e04ce73d8d9b0bffeda1586f2c2fa22e71/src/ColorContrast.php#L48-L60 |
davidgorges/color-contrast-php | src/ColorContrast.php | ColorContrast.getCombinations | public function getCombinations($minContrast = 0.0)
{
$combinations = array();
foreach ($this->colors as $backgroundColor) {
foreach ($this->colors as $foregroundColor) {
if ($backgroundColor == $foregroundColor) {
continue;
}
... | php | public function getCombinations($minContrast = 0.0)
{
$combinations = array();
foreach ($this->colors as $backgroundColor) {
foreach ($this->colors as $foregroundColor) {
if ($backgroundColor == $foregroundColor) {
continue;
}
... | [
"public",
"function",
"getCombinations",
"(",
"$",
"minContrast",
"=",
"0.0",
")",
"{",
"$",
"combinations",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"colors",
"as",
"$",
"backgroundColor",
")",
"{",
"foreach",
"(",
"$",
"this",
... | @param float $minContrast
@return ColorCombination[] | [
"@param",
"float",
"$minContrast"
] | train | https://github.com/davidgorges/color-contrast-php/blob/11edc6e04ce73d8d9b0bffeda1586f2c2fa22e71/src/ColorContrast.php#L85-L102 |
davidgorges/color-contrast-php | src/ColorContrast.php | ColorContrast.parseColor | private function parseColor($color)
{
try {
if ($color instanceof ColorJizz) {
return $color;
}
if (is_string($color)) {
if (substr($color, 0, 1) == '#') {
return Hex::fromString(substr($color, 1));
}
... | php | private function parseColor($color)
{
try {
if ($color instanceof ColorJizz) {
return $color;
}
if (is_string($color)) {
if (substr($color, 0, 1) == '#') {
return Hex::fromString(substr($color, 1));
}
... | [
"private",
"function",
"parseColor",
"(",
"$",
"color",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"color",
"instanceof",
"ColorJizz",
")",
"{",
"return",
"$",
"color",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"color",
")",
")",
"{",
"if",
"(",
"subs... | @param $color
@return Hex
@throws InvalidColorException
@throws InvalidArgumentException | [
"@param",
"$color"
] | train | https://github.com/davidgorges/color-contrast-php/blob/11edc6e04ce73d8d9b0bffeda1586f2c2fa22e71/src/ColorContrast.php#L119-L142 |
davidgorges/color-contrast-php | src/ColorContrast.php | ColorContrast.complimentaryTheme | public function complimentaryTheme($color)
{
$parsedColor = $this->parseColor($color);
$yiq = $this->calculateYIQValue($parsedColor->toRGB());
if ($yiq > 128) {
return self::DARK;
} else {
return self::LIGHT;
}
} | php | public function complimentaryTheme($color)
{
$parsedColor = $this->parseColor($color);
$yiq = $this->calculateYIQValue($parsedColor->toRGB());
if ($yiq > 128) {
return self::DARK;
} else {
return self::LIGHT;
}
} | [
"public",
"function",
"complimentaryTheme",
"(",
"$",
"color",
")",
"{",
"$",
"parsedColor",
"=",
"$",
"this",
"->",
"parseColor",
"(",
"$",
"color",
")",
";",
"$",
"yiq",
"=",
"$",
"this",
"->",
"calculateYIQValue",
"(",
"$",
"parsedColor",
"->",
"toRGB... | Tries to detect what font-color you should use as complimentary color.
e.g. complimentaryTheme('#ffffff') would return ColorContrast::DARK
@param $color
@return string ColorContrast::LIGHT or ColorContrast::DARK | [
"Tries",
"to",
"detect",
"what",
"font",
"-",
"color",
"you",
"should",
"use",
"as",
"complimentary",
"color",
".",
"e",
".",
"g",
".",
"complimentaryTheme",
"(",
"#ffffff",
")",
"would",
"return",
"ColorContrast",
"::",
"DARK",
"@param",
"$color"
] | train | https://github.com/davidgorges/color-contrast-php/blob/11edc6e04ce73d8d9b0bffeda1586f2c2fa22e71/src/ColorContrast.php#L151-L160 |
davidgorges/color-contrast-php | src/ColorContrast.php | ColorContrast.calculateYIQValue | private function calculateYIQValue(RGB $color)
{
$yiq = (($color->getRed() * 299) + ($color->getGreen() * 587) + ($color->getBlue() * 114)) / 1000;
return $yiq;
} | php | private function calculateYIQValue(RGB $color)
{
$yiq = (($color->getRed() * 299) + ($color->getGreen() * 587) + ($color->getBlue() * 114)) / 1000;
return $yiq;
} | [
"private",
"function",
"calculateYIQValue",
"(",
"RGB",
"$",
"color",
")",
"{",
"$",
"yiq",
"=",
"(",
"(",
"$",
"color",
"->",
"getRed",
"(",
")",
"*",
"299",
")",
"+",
"(",
"$",
"color",
"->",
"getGreen",
"(",
")",
"*",
"587",
")",
"+",
"(",
"... | calculates the YIQ value for a given color.
@param RGB $color
@return float 0-255 | [
"calculates",
"the",
"YIQ",
"value",
"for",
"a",
"given",
"color",
"."
] | train | https://github.com/davidgorges/color-contrast-php/blob/11edc6e04ce73d8d9b0bffeda1586f2c2fa22e71/src/ColorContrast.php#L169-L173 |
aryelgois/yasql-php | src/Parser.php | Parser.extractKeyword | protected static function extractKeyword(
string $haystack,
string $needle,
&$matches = null
) {
$pattern = '/' . (strpos($needle, '^') === 0 ? '' : ' ?') . $needle
. (strrpos($needle, '$') === strlen($needle)-1 ? '' : ' ?') . '/i';
if (preg_match($pattern, $hays... | php | protected static function extractKeyword(
string $haystack,
string $needle,
&$matches = null
) {
$pattern = '/' . (strpos($needle, '^') === 0 ? '' : ' ?') . $needle
. (strrpos($needle, '$') === strlen($needle)-1 ? '' : ' ?') . '/i';
if (preg_match($pattern, $hays... | [
"protected",
"static",
"function",
"extractKeyword",
"(",
"string",
"$",
"haystack",
",",
"string",
"$",
"needle",
",",
"&",
"$",
"matches",
"=",
"null",
")",
"{",
"$",
"pattern",
"=",
"'/'",
".",
"(",
"strpos",
"(",
"$",
"needle",
",",
"'^'",
")",
"... | Extracts a keyword from a string
@param string $haystack String to look for the keyword
@param string $needle PCRE subpattern with the keyword (insensitive)
@param string $matches @see \preg_match() $matches (PREG_OFFSET_CAPTURE)
@return false If the keyword was not found
@return string The string without the key... | [
"Extracts",
"a",
"keyword",
"from",
"a",
"string"
] | train | https://github.com/aryelgois/yasql-php/blob/f428b180d35bfc1ddf1f9b3323f9b085fbc09ac7/src/Parser.php#L404-L418 |
aryelgois/yasql-php | src/Parser.php | Parser.strContains | protected static function strContains($str, array $arr)
{
foreach ($arr as $a) {
if (stripos($str, $a) !== false) {
return true;
}
}
return false;
} | php | protected static function strContains($str, array $arr)
{
foreach ($arr as $a) {
if (stripos($str, $a) !== false) {
return true;
}
}
return false;
} | [
"protected",
"static",
"function",
"strContains",
"(",
"$",
"str",
",",
"array",
"$",
"arr",
")",
"{",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"a",
")",
"{",
"if",
"(",
"stripos",
"(",
"$",
"str",
",",
"$",
"a",
")",
"!==",
"false",
")",
"{",
"r... | Tells if a string contains any items in an array (case insensitive)
@author zombat
@link https://stackoverflow.com/a/2124557
@param string $str A string to be tested
@param array $arr List of substrings that could be in $str
@return bool | [
"Tells",
"if",
"a",
"string",
"contains",
"any",
"items",
"in",
"an",
"array",
"(",
"case",
"insensitive",
")"
] | train | https://github.com/aryelgois/yasql-php/blob/f428b180d35bfc1ddf1f9b3323f9b085fbc09ac7/src/Parser.php#L441-L449 |
titon/db | src/Titon/Db/Database.php | Database.getDriver | public function getDriver($key) {
if (isset($this->_drivers[$key])) {
return $this->_drivers[$key];
}
throw new MissingDriverException(sprintf('Driver %s does not exist', $key));
} | php | public function getDriver($key) {
if (isset($this->_drivers[$key])) {
return $this->_drivers[$key];
}
throw new MissingDriverException(sprintf('Driver %s does not exist', $key));
} | [
"public",
"function",
"getDriver",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_drivers",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_drivers",
"[",
"$",
"key",
"]",
";",
"}",
"throw",
"new",
... | Return a driver by key.
@param string $key
@return \Titon\Db\Driver
@throws \Titon\Db\Exception\MissingDriverException | [
"Return",
"a",
"driver",
"by",
"key",
"."
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Database.php#L49-L55 |
PeekAndPoke/psi | src/Operation/FullSet/SortByOperation.php | SortByOperation.apply | public function apply(\Iterator $set)
{
$func = $this->function;
$data = iterator_to_array($set);
usort($data, function ($i1, $i2) use ($func) {
$val1 = $func($i1);
$val2 = $func($i2);
if ($val1 === $val2) {
return 0;
}
... | php | public function apply(\Iterator $set)
{
$func = $this->function;
$data = iterator_to_array($set);
usort($data, function ($i1, $i2) use ($func) {
$val1 = $func($i1);
$val2 = $func($i2);
if ($val1 === $val2) {
return 0;
}
... | [
"public",
"function",
"apply",
"(",
"\\",
"Iterator",
"$",
"set",
")",
"{",
"$",
"func",
"=",
"$",
"this",
"->",
"function",
";",
"$",
"data",
"=",
"iterator_to_array",
"(",
"$",
"set",
")",
";",
"usort",
"(",
"$",
"data",
",",
"function",
"(",
"$"... | @param \Iterator $set
@return \Iterator | [
"@param",
"\\",
"Iterator",
"$set"
] | train | https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/Operation/FullSet/SortByOperation.php#L25-L43 |
mihai-stancu/serializer | Serializer/Normalizer/StreamNormalizer.php | StreamNormalizer.normalize | public function normalize($stream, $format = null, array $context = array())
{
$string = stream_get_contents($stream);
return parent::normalize($string, $format, $context);
} | php | public function normalize($stream, $format = null, array $context = array())
{
$string = stream_get_contents($stream);
return parent::normalize($string, $format, $context);
} | [
"public",
"function",
"normalize",
"(",
"$",
"stream",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"$",
"string",
"=",
"stream_get_contents",
"(",
"$",
"stream",
")",
";",
"return",
"parent",
"::",
... | @param resource $stream
@param string $format
@param array $context
@return array|bool|float|int|null|string | [
"@param",
"resource",
"$stream",
"@param",
"string",
"$format",
"@param",
"array",
"$context"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/StreamNormalizer.php#L28-L33 |
mihai-stancu/serializer | Serializer/Normalizer/StreamNormalizer.php | StreamNormalizer.denormalize | public function denormalize($data, $class, $format = null, array $context = array())
{
$string = parent::denormalize($data, $class, $format, $context);
return fopen('data:,'.$string, 'r');
} | php | public function denormalize($data, $class, $format = null, array $context = array())
{
$string = parent::denormalize($data, $class, $format, $context);
return fopen('data:,'.$string, 'r');
} | [
"public",
"function",
"denormalize",
"(",
"$",
"data",
",",
"$",
"class",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"$",
"string",
"=",
"parent",
"::",
"denormalize",
"(",
"$",
"data",
",",
"$"... | @param string $data
@param string $class
@param string $format
@param array $context
@return resource | [
"@param",
"string",
"$data",
"@param",
"string",
"$class",
"@param",
"string",
"$format",
"@param",
"array",
"$context"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/StreamNormalizer.php#L54-L59 |
zodream/thirdparty | src/ALi/Rsa.php | Rsa.encrypt | public function encrypt($data){
$maxlength = $this->getMaxEncryptBlockSize($this->publicKey);
$output='';
while(strlen($data)){
$input = substr($data, 0, $maxlength);
$data = substr($data, $maxlength);
openssl_public_encrypt($input, $encrypted, $this->publicKe... | php | public function encrypt($data){
$maxlength = $this->getMaxEncryptBlockSize($this->publicKey);
$output='';
while(strlen($data)){
$input = substr($data, 0, $maxlength);
$data = substr($data, $maxlength);
openssl_public_encrypt($input, $encrypted, $this->publicKe... | [
"public",
"function",
"encrypt",
"(",
"$",
"data",
")",
"{",
"$",
"maxlength",
"=",
"$",
"this",
"->",
"getMaxEncryptBlockSize",
"(",
"$",
"this",
"->",
"publicKey",
")",
";",
"$",
"output",
"=",
"''",
";",
"while",
"(",
"strlen",
"(",
"$",
"data",
"... | rsa加密
@param $data 要加密的数据
@return string 加密后的密文 | [
"rsa加密"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/ALi/Rsa.php#L28-L39 |
zodream/thirdparty | src/ALi/Rsa.php | Rsa.decrypt | public function decrypt($data){
$data = base64_decode($data);
$maxlength = $this->getMaxDecryptBlockSize($this->privateKey);
$output='';
while(strlen($data)){
$input = substr($data, 0, $maxlength);
$data = substr($data, $maxlength);
openssl_private_dec... | php | public function decrypt($data){
$data = base64_decode($data);
$maxlength = $this->getMaxDecryptBlockSize($this->privateKey);
$output='';
while(strlen($data)){
$input = substr($data, 0, $maxlength);
$data = substr($data, $maxlength);
openssl_private_dec... | [
"public",
"function",
"decrypt",
"(",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"base64_decode",
"(",
"$",
"data",
")",
";",
"$",
"maxlength",
"=",
"$",
"this",
"->",
"getMaxDecryptBlockSize",
"(",
"$",
"this",
"->",
"privateKey",
")",
";",
"$",
"output... | 解密
@param $data 要解密的数据
@return string 解密后的明文 | [
"解密"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/ALi/Rsa.php#L46-L57 |
aedart/laravel-helpers | src/Traits/Http/RequestTrait.php | RequestTrait.getRequest | public function getRequest(): ?Request
{
if (!$this->hasRequest()) {
$this->setRequest($this->getDefaultRequest());
}
return $this->request;
} | php | public function getRequest(): ?Request
{
if (!$this->hasRequest()) {
$this->setRequest($this->getDefaultRequest());
}
return $this->request;
} | [
"public",
"function",
"getRequest",
"(",
")",
":",
"?",
"Request",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRequest",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setRequest",
"(",
"$",
"this",
"->",
"getDefaultRequest",
"(",
")",
")",
";",
"}",
"ret... | Get request
If no request has been set, this method will
set and return a default request, if any such
value is available
@see getDefaultRequest()
@return Request|null request or null if none request has been set | [
"Get",
"request"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Http/RequestTrait.php#L53-L59 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.openAction | public function openAction(Forum $forum)
{
$em = $this->getDoctrine()->getManager();
$this->checkAccess($forum);
$categories = $em->getRepository('ClarolineForumBundle:Forum')->findCategories($forum);
$user = $this->tokenStorage->getToken()->getUser();
$hasSubscribed = $user ... | php | public function openAction(Forum $forum)
{
$em = $this->getDoctrine()->getManager();
$this->checkAccess($forum);
$categories = $em->getRepository('ClarolineForumBundle:Forum')->findCategories($forum);
$user = $this->tokenStorage->getToken()->getUser();
$hasSubscribed = $user ... | [
"public",
"function",
"openAction",
"(",
"Forum",
"$",
"forum",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"this",
"->",
"checkAccess",
"(",
"$",
"forum",
")",
";",
"$",
"categories",... | @Route(
"/{forum}/category",
name="claro_forum_categories",
defaults={"page"=1}
)
@Template("ClarolineForumBundle::index.html.twig")
@param Forum $forum
@param User $user | [
"@Route",
"(",
"/",
"{",
"forum",
"}",
"/",
"category",
"name",
"=",
"claro_forum_categories",
"defaults",
"=",
"{",
"page",
"=",
"1",
"}",
")",
"@Template",
"(",
"ClarolineForumBundle",
"::",
"index",
".",
"html",
".",
"twig",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L77-L99 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.subjectsAction | public function subjectsAction(Category $category, $page, $max)
{
$forum = $category->getForum();
$this->checkAccess($forum);
$pager = $this->manager->getSubjectsPager($category, $page, $max);
$subjectsIds = array();
$lastMessages = array();
foreach ($pager as $subj... | php | public function subjectsAction(Category $category, $page, $max)
{
$forum = $category->getForum();
$this->checkAccess($forum);
$pager = $this->manager->getSubjectsPager($category, $page, $max);
$subjectsIds = array();
$lastMessages = array();
foreach ($pager as $subj... | [
"public",
"function",
"subjectsAction",
"(",
"Category",
"$",
"category",
",",
"$",
"page",
",",
"$",
"max",
")",
"{",
"$",
"forum",
"=",
"$",
"category",
"->",
"getForum",
"(",
")",
";",
"$",
"this",
"->",
"checkAccess",
"(",
"$",
"forum",
")",
";",... | @Route(
"/category/{category}/subjects/page/{page}/max/{max}",
name="claro_forum_subjects",
defaults={"page"=1, "max"=20},
options={"expose"=true}
)
@Template()
@param Category $category
@param integer $page
@param integer $max | [
"@Route",
"(",
"/",
"category",
"/",
"{",
"category",
"}",
"/",
"subjects",
"/",
"page",
"/",
"{",
"page",
"}",
"/",
"max",
"/",
"{",
"max",
"}",
"name",
"=",
"claro_forum_subjects",
"defaults",
"=",
"{",
"page",
"=",
"1",
"max",
"=",
"20",
"}",
... | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L114-L170 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.subjectFormAction | public function subjectFormAction(Category $category)
{
$forum = $category->getForum();
$collection = new ResourceCollection(array($forum->getResourceNode()));
if (!$this->authorization->isGranted('post', $collection)) {
throw new AccessDeniedException($collection->getErrorsForD... | php | public function subjectFormAction(Category $category)
{
$forum = $category->getForum();
$collection = new ResourceCollection(array($forum->getResourceNode()));
if (!$this->authorization->isGranted('post', $collection)) {
throw new AccessDeniedException($collection->getErrorsForD... | [
"public",
"function",
"subjectFormAction",
"(",
"Category",
"$",
"category",
")",
"{",
"$",
"forum",
"=",
"$",
"category",
"->",
"getForum",
"(",
")",
";",
"$",
"collection",
"=",
"new",
"ResourceCollection",
"(",
"array",
"(",
"$",
"forum",
"->",
"getReso... | @Route(
"/form/subject/{category}",
name="claro_forum_form_subject_creation"
)
@ParamConverter("authenticatedUser", options={"authenticatedUser" = true})
@Template()
@param Category $category | [
"@Route",
"(",
"/",
"form",
"/",
"subject",
"/",
"{",
"category",
"}",
"name",
"=",
"claro_forum_form_subject_creation",
")",
"@ParamConverter",
"(",
"authenticatedUser",
"options",
"=",
"{",
"authenticatedUser",
"=",
"true",
"}",
")",
"@Template",
"()"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L182-L199 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.categoryFormAction | public function categoryFormAction(Forum $forum)
{
$collection = new ResourceCollection(array($forum->getResourceNode()));
if (!$this->authorization->isGranted('post', $collection)) {
throw new AccessDeniedException($collection->getErrorsForDisplay());
}
$formCategory =... | php | public function categoryFormAction(Forum $forum)
{
$collection = new ResourceCollection(array($forum->getResourceNode()));
if (!$this->authorization->isGranted('post', $collection)) {
throw new AccessDeniedException($collection->getErrorsForDisplay());
}
$formCategory =... | [
"public",
"function",
"categoryFormAction",
"(",
"Forum",
"$",
"forum",
")",
"{",
"$",
"collection",
"=",
"new",
"ResourceCollection",
"(",
"array",
"(",
"$",
"forum",
"->",
"getResourceNode",
"(",
")",
")",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
... | @Route(
"/form/category/{forum}",
name="claro_forum_form_category_creation"
)
@ParamConverter("authenticatedUser", options={"authenticatedUser" = true})
@Template()
@param Forum $forum | [
"@Route",
"(",
"/",
"form",
"/",
"category",
"/",
"{",
"forum",
"}",
"name",
"=",
"claro_forum_form_category_creation",
")",
"@ParamConverter",
"(",
"authenticatedUser",
"options",
"=",
"{",
"authenticatedUser",
"=",
"true",
"}",
")",
"@Template",
"()"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L211-L226 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.createSubjectAction | public function createSubjectAction(Category $category)
{
$forum = $category->getForum();
$collection = new ResourceCollection(array($forum->getResourceNode()));
if (!$this->authorization->isGranted('post', $collection)) {
throw new AccessDeniedException($collection->getErrorsFo... | php | public function createSubjectAction(Category $category)
{
$forum = $category->getForum();
$collection = new ResourceCollection(array($forum->getResourceNode()));
if (!$this->authorization->isGranted('post', $collection)) {
throw new AccessDeniedException($collection->getErrorsFo... | [
"public",
"function",
"createSubjectAction",
"(",
"Category",
"$",
"category",
")",
"{",
"$",
"forum",
"=",
"$",
"category",
"->",
"getForum",
"(",
")",
";",
"$",
"collection",
"=",
"new",
"ResourceCollection",
"(",
"array",
"(",
"$",
"forum",
"->",
"getRe... | The form submission is working but I had to do some weird things to make it works.
@Route(
"/subject/create/{category}",
name="claro_forum_create_subject"
)
@ParamConverter("authenticatedUser", options={"authenticatedUser" = true})
@Template("ClarolineForumBundle:Forum:subjectForm.html.twig")
@param Category $category... | [
"The",
"form",
"submission",
"is",
"working",
"but",
"I",
"had",
"to",
"do",
"some",
"weird",
"things",
"to",
"make",
"it",
"works",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L272-L317 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.messagesAction | public function messagesAction(Subject $subject, $page, $max)
{
$forum = $subject->getCategory()->getForum();
$this->checkAccess($forum);
$isAnon = $this->isAnon();
$isModerator = $this->authorization->isGranted(
'moderate',
new ResourceCollection(array($forum... | php | public function messagesAction(Subject $subject, $page, $max)
{
$forum = $subject->getCategory()->getForum();
$this->checkAccess($forum);
$isAnon = $this->isAnon();
$isModerator = $this->authorization->isGranted(
'moderate',
new ResourceCollection(array($forum... | [
"public",
"function",
"messagesAction",
"(",
"Subject",
"$",
"subject",
",",
"$",
"page",
",",
"$",
"max",
")",
"{",
"$",
"forum",
"=",
"$",
"subject",
"->",
"getCategory",
"(",
")",
"->",
"getForum",
"(",
")",
";",
"$",
"this",
"->",
"checkAccess",
... | @Route(
"/subject/{subject}/messages/page/{page}/max/{max}",
name="claro_forum_messages",
defaults={"page"=1, "max"= 20},
options={"expose"=true}
)
@Template()
@param Subject $subject
@param integer $page
@param integer $max | [
"@Route",
"(",
"/",
"subject",
"/",
"{",
"subject",
"}",
"/",
"messages",
"/",
"page",
"/",
"{",
"page",
"}",
"/",
"max",
"/",
"{",
"max",
"}",
"name",
"=",
"claro_forum_messages",
"defaults",
"=",
"{",
"page",
"=",
"1",
"max",
"=",
"20",
"}",
"o... | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L332-L368 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.createMessageAction | public function createMessageAction(Subject $subject)
{
$form = $this->container->get('form.factory')->create(new MessageType, new Message());
$form->handleRequest($this->get('request'));
if ($form->isValid()) {
$message = $form->getData();
$this->manager->createMes... | php | public function createMessageAction(Subject $subject)
{
$form = $this->container->get('form.factory')->create(new MessageType, new Message());
$form->handleRequest($this->get('request'));
if ($form->isValid()) {
$message = $form->getData();
$this->manager->createMes... | [
"public",
"function",
"createMessageAction",
"(",
"Subject",
"$",
"subject",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'form.factory'",
")",
"->",
"create",
"(",
"new",
"MessageType",
",",
"new",
"Message",
"(",
")",
... | @Route(
"/create/message/{subject}",
name="claro_forum_create_message"
)
@ParamConverter("authenticatedUser", options={"authenticatedUser" = true})
@param Subject $subject | [
"@Route",
"(",
"/",
"create",
"/",
"message",
"/",
"{",
"subject",
"}",
"name",
"=",
"claro_forum_create_message",
")",
"@ParamConverter",
"(",
"authenticatedUser",
"options",
"=",
"{",
"authenticatedUser",
"=",
"true",
"}",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L379-L393 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.editMessageAction | public function editMessageAction(Message $message)
{
$subject = $message->getSubject();
$forum = $subject->getCategory()->getForum();
$isModerator = $this->authorization->isGranted('moderate', new ResourceCollection(array($forum->getResourceNode())));
if (!$isModerator && $this->to... | php | public function editMessageAction(Message $message)
{
$subject = $message->getSubject();
$forum = $subject->getCategory()->getForum();
$isModerator = $this->authorization->isGranted('moderate', new ResourceCollection(array($forum->getResourceNode())));
if (!$isModerator && $this->to... | [
"public",
"function",
"editMessageAction",
"(",
"Message",
"$",
"message",
")",
"{",
"$",
"subject",
"=",
"$",
"message",
"->",
"getSubject",
"(",
")",
";",
"$",
"forum",
"=",
"$",
"subject",
"->",
"getCategory",
"(",
")",
"->",
"getForum",
"(",
")",
"... | @Route(
"/edit/message/{message}",
name="claro_forum_edit_message"
)
@Template("ClarolineForumBundle:Forum:editMessageForm.html.twig")
@param Message $message | [
"@Route",
"(",
"/",
"edit",
"/",
"message",
"/",
"{",
"message",
"}",
"name",
"=",
"claro_forum_edit_message",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L433-L463 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.deleteCategory | public function deleteCategory(Category $category)
{
$forum = $category->getForum();
if ($this->authorization->isGranted('moderate', new ResourceCollection(array($category->getForum()->getResourceNode())))) {
$this->manager->deleteCategory($category);
return new RedirectRe... | php | public function deleteCategory(Category $category)
{
$forum = $category->getForum();
if ($this->authorization->isGranted('moderate', new ResourceCollection(array($category->getForum()->getResourceNode())))) {
$this->manager->deleteCategory($category);
return new RedirectRe... | [
"public",
"function",
"deleteCategory",
"(",
"Category",
"$",
"category",
")",
"{",
"$",
"forum",
"=",
"$",
"category",
"->",
"getForum",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"authorization",
"->",
"isGranted",
"(",
"'moderate'",
",",
"new",
"Res... | @Route(
"/delete/category/{category}",
name="claro_forum_delete_category"
)
@param Category $category | [
"@Route",
"(",
"/",
"delete",
"/",
"category",
"/",
"{",
"category",
"}",
"name",
"=",
"claro_forum_delete_category",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L531-L545 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.deleteMessageAction | public function deleteMessageAction(Message $message)
{
if ($this->authorization->isGranted('moderate', new ResourceCollection(array($message->getSubject()->getCategory()->getForum()->getResourceNode())))) {
$this->manager->deleteMessage($message);
return new RedirectResponse(
... | php | public function deleteMessageAction(Message $message)
{
if ($this->authorization->isGranted('moderate', new ResourceCollection(array($message->getSubject()->getCategory()->getForum()->getResourceNode())))) {
$this->manager->deleteMessage($message);
return new RedirectResponse(
... | [
"public",
"function",
"deleteMessageAction",
"(",
"Message",
"$",
"message",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"authorization",
"->",
"isGranted",
"(",
"'moderate'",
",",
"new",
"ResourceCollection",
"(",
"array",
"(",
"$",
"message",
"->",
"getSubject",... | @Route(
"/delete/message/{message}",
name="claro_forum_delete_message"
)
@param \Claroline\ForumBundle\Entity\Message $message | [
"@Route",
"(",
"/",
"delete",
"/",
"message",
"/",
"{",
"message",
"}",
"name",
"=",
"claro_forum_delete_message",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L659-L670 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.subscribeAction | public function subscribeAction(Forum $forum, User $user)
{
$this->manager->subscribe($forum, $user);
return new RedirectResponse(
$this->generateUrl('claro_forum_categories', array('forum' => $forum->getId()))
);
} | php | public function subscribeAction(Forum $forum, User $user)
{
$this->manager->subscribe($forum, $user);
return new RedirectResponse(
$this->generateUrl('claro_forum_categories', array('forum' => $forum->getId()))
);
} | [
"public",
"function",
"subscribeAction",
"(",
"Forum",
"$",
"forum",
",",
"User",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"manager",
"->",
"subscribe",
"(",
"$",
"forum",
",",
"$",
"user",
")",
";",
"return",
"new",
"RedirectResponse",
"(",
"$",
"thi... | @Route(
"/subscribe/forum/{forum}",
name="claro_forum_subscribe"
)
@EXT\ParamConverter("user", options={"authenticatedUser" = true})
@param Forum $forum
@param User $user | [
"@Route",
"(",
"/",
"subscribe",
"/",
"forum",
"/",
"{",
"forum",
"}",
"name",
"=",
"claro_forum_subscribe",
")",
"@EXT",
"\\",
"ParamConverter",
"(",
"user",
"options",
"=",
"{",
"authenticatedUser",
"=",
"true",
"}",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L682-L689 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.unsubscribeAction | public function unsubscribeAction(Forum $forum, User $user)
{
$this->manager->unsubscribe($forum, $user);
return new RedirectResponse(
$this->generateUrl('claro_forum_categories', array('forum' => $forum->getId()))
);
} | php | public function unsubscribeAction(Forum $forum, User $user)
{
$this->manager->unsubscribe($forum, $user);
return new RedirectResponse(
$this->generateUrl('claro_forum_categories', array('forum' => $forum->getId()))
);
} | [
"public",
"function",
"unsubscribeAction",
"(",
"Forum",
"$",
"forum",
",",
"User",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"manager",
"->",
"unsubscribe",
"(",
"$",
"forum",
",",
"$",
"user",
")",
";",
"return",
"new",
"RedirectResponse",
"(",
"$",
... | @Route(
"/unsubscribe/forum/{forum}",
name="claro_forum_unsubscribe"
)
@EXT\ParamConverter("user", options={"authenticatedUser" = true})
@param Forum $forum
@param User $user | [
"@Route",
"(",
"/",
"unsubscribe",
"/",
"forum",
"/",
"{",
"forum",
"}",
"name",
"=",
"claro_forum_unsubscribe",
")",
"@EXT",
"\\",
"ParamConverter",
"(",
"user",
"options",
"=",
"{",
"authenticatedUser",
"=",
"true",
"}",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L701-L708 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.deleteSubjectAction | public function deleteSubjectAction(Subject $subject)
{
if ($this->authorization->isGranted('moderate', new ResourceCollection(array($subject->getCategory()->getForum()->getResourceNode())))) {
$this->manager->deleteSubject($subject);
return new RedirectResponse(
$t... | php | public function deleteSubjectAction(Subject $subject)
{
if ($this->authorization->isGranted('moderate', new ResourceCollection(array($subject->getCategory()->getForum()->getResourceNode())))) {
$this->manager->deleteSubject($subject);
return new RedirectResponse(
$t... | [
"public",
"function",
"deleteSubjectAction",
"(",
"Subject",
"$",
"subject",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"authorization",
"->",
"isGranted",
"(",
"'moderate'",
",",
"new",
"ResourceCollection",
"(",
"array",
"(",
"$",
"subject",
"->",
"getCategory"... | @Route(
"/delete/subject/{subject}",
name="claro_forum_delete_subject"
)
@param Subject $subject | [
"@Route",
"(",
"/",
"delete",
"/",
"subject",
"/",
"{",
"subject",
"}",
"name",
"=",
"claro_forum_delete_subject",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L718-L730 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.moveMessageAction | public function moveMessageAction(Message $message, Subject $newSubject)
{
$forum = $newSubject->getCategory()->getForum();
$this->checkAccess($forum);
$this->manager->moveMessage($message, $newSubject);
return new RedirectResponse(
$this->generateUrl('claro_forum_subjec... | php | public function moveMessageAction(Message $message, Subject $newSubject)
{
$forum = $newSubject->getCategory()->getForum();
$this->checkAccess($forum);
$this->manager->moveMessage($message, $newSubject);
return new RedirectResponse(
$this->generateUrl('claro_forum_subjec... | [
"public",
"function",
"moveMessageAction",
"(",
"Message",
"$",
"message",
",",
"Subject",
"$",
"newSubject",
")",
"{",
"$",
"forum",
"=",
"$",
"newSubject",
"->",
"getCategory",
"(",
")",
"->",
"getForum",
"(",
")",
";",
"$",
"this",
"->",
"checkAccess",
... | @EXT\Route(
"/message/{message}/move/{newSubject}",
name="claro_message_move",
options={"expose"=true}
)
@EXT\Method("GET")
@param Message $message
@param Subject $newSubject | [
"@EXT",
"\\",
"Route",
"(",
"/",
"message",
"/",
"{",
"message",
"}",
"/",
"move",
"/",
"{",
"newSubject",
"}",
"name",
"=",
"claro_message_move",
"options",
"=",
"{",
"expose",
"=",
"true",
"}",
")",
"@EXT",
"\\",
"Method",
"(",
"GET",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L819-L828 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.moveSubjectAction | public function moveSubjectAction(Subject $subject, Category $newCategory)
{
$forum = $newCategory->getForum();
$this->checkAccess($forum);
$this->manager->moveSubject($subject, $newCategory);
return new RedirectResponse(
$this->generateUrl('claro_forum_categories', arra... | php | public function moveSubjectAction(Subject $subject, Category $newCategory)
{
$forum = $newCategory->getForum();
$this->checkAccess($forum);
$this->manager->moveSubject($subject, $newCategory);
return new RedirectResponse(
$this->generateUrl('claro_forum_categories', arra... | [
"public",
"function",
"moveSubjectAction",
"(",
"Subject",
"$",
"subject",
",",
"Category",
"$",
"newCategory",
")",
"{",
"$",
"forum",
"=",
"$",
"newCategory",
"->",
"getForum",
"(",
")",
";",
"$",
"this",
"->",
"checkAccess",
"(",
"$",
"forum",
")",
";... | @EXT\Route(
"/subject/{subject}/move/{newCategory}",
name="claro_subject_move",
options={"expose"=true}
)
@EXT\Method("GET")
@param Subject $subject
@param Category $newCategory | [
"@EXT",
"\\",
"Route",
"(",
"/",
"subject",
"/",
"{",
"subject",
"}",
"/",
"move",
"/",
"{",
"newCategory",
"}",
"name",
"=",
"claro_subject_move",
"options",
"=",
"{",
"expose",
"=",
"true",
"}",
")",
"@EXT",
"\\",
"Method",
"(",
"GET",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L841-L850 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.stickSubjectAction | public function stickSubjectAction(Subject $subject)
{
$forum = $subject->getCategory()->getForum();
$this->checkAccess($forum);
$this->manager->stickSubject($subject);
return new RedirectResponse(
$this->generateUrl('claro_forum_subjects', array('category' => $subject->... | php | public function stickSubjectAction(Subject $subject)
{
$forum = $subject->getCategory()->getForum();
$this->checkAccess($forum);
$this->manager->stickSubject($subject);
return new RedirectResponse(
$this->generateUrl('claro_forum_subjects', array('category' => $subject->... | [
"public",
"function",
"stickSubjectAction",
"(",
"Subject",
"$",
"subject",
")",
"{",
"$",
"forum",
"=",
"$",
"subject",
"->",
"getCategory",
"(",
")",
"->",
"getForum",
"(",
")",
";",
"$",
"this",
"->",
"checkAccess",
"(",
"$",
"forum",
")",
";",
"$",... | @EXT\Route(
"/stick/subject/{subject}",
name="claro_subject_stick",
options={"expose"=true}
)
@EXT\Method("GET")
@param Subject $subject | [
"@EXT",
"\\",
"Route",
"(",
"/",
"stick",
"/",
"subject",
"/",
"{",
"subject",
"}",
"name",
"=",
"claro_subject_stick",
"options",
"=",
"{",
"expose",
"=",
"true",
"}",
")",
"@EXT",
"\\",
"Method",
"(",
"GET",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L862-L871 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.unstickSubjectAction | public function unstickSubjectAction(Subject $subject)
{
$forum = $subject->getCategory()->getForum();
$this->checkAccess($forum);
$this->manager->unstickSubject($subject);
return new RedirectResponse(
$this->generateUrl('claro_forum_subjects', array('category' => $subje... | php | public function unstickSubjectAction(Subject $subject)
{
$forum = $subject->getCategory()->getForum();
$this->checkAccess($forum);
$this->manager->unstickSubject($subject);
return new RedirectResponse(
$this->generateUrl('claro_forum_subjects', array('category' => $subje... | [
"public",
"function",
"unstickSubjectAction",
"(",
"Subject",
"$",
"subject",
")",
"{",
"$",
"forum",
"=",
"$",
"subject",
"->",
"getCategory",
"(",
")",
"->",
"getForum",
"(",
")",
";",
"$",
"this",
"->",
"checkAccess",
"(",
"$",
"forum",
")",
";",
"$... | @EXT\Route(
"/unstick/subject/{subject}",
name="claro_subject_unstick",
options={"expose"=true}
)
@EXT\Method("GET")
@param Subject $subject | [
"@EXT",
"\\",
"Route",
"(",
"/",
"unstick",
"/",
"subject",
"/",
"{",
"subject",
"}",
"name",
"=",
"claro_subject_unstick",
"options",
"=",
"{",
"expose",
"=",
"true",
"}",
")",
"@EXT",
"\\",
"Method",
"(",
"GET",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L883-L892 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.closeSubjectAction | public function closeSubjectAction(Subject $subject)
{
$forum = $subject->getCategory()->getForum();
$this->checkAccess($forum);
$this->manager->closeSubject($subject);
return new RedirectResponse(
$this->generateUrl('claro_forum_subjects', array('category' => $subject->... | php | public function closeSubjectAction(Subject $subject)
{
$forum = $subject->getCategory()->getForum();
$this->checkAccess($forum);
$this->manager->closeSubject($subject);
return new RedirectResponse(
$this->generateUrl('claro_forum_subjects', array('category' => $subject->... | [
"public",
"function",
"closeSubjectAction",
"(",
"Subject",
"$",
"subject",
")",
"{",
"$",
"forum",
"=",
"$",
"subject",
"->",
"getCategory",
"(",
")",
"->",
"getForum",
"(",
")",
";",
"$",
"this",
"->",
"checkAccess",
"(",
"$",
"forum",
")",
";",
"$",... | @EXT\Route(
"/close/subject/{subject}",
name="claro_subject_close",
options={"expose"=true}
)
@EXT\Method("GET")
@param Subject $subject | [
"@EXT",
"\\",
"Route",
"(",
"/",
"close",
"/",
"subject",
"/",
"{",
"subject",
"}",
"name",
"=",
"claro_subject_close",
"options",
"=",
"{",
"expose",
"=",
"true",
"}",
")",
"@EXT",
"\\",
"Method",
"(",
"GET",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L904-L913 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.openSubjectAction | public function openSubjectAction(Subject $subject)
{
$forum = $subject->getCategory()->getForum();
$this->checkAccess($forum);
$this->manager->openSubject($subject);
return new RedirectResponse(
$this->generateUrl('claro_forum_subjects', array('category' => $subject->ge... | php | public function openSubjectAction(Subject $subject)
{
$forum = $subject->getCategory()->getForum();
$this->checkAccess($forum);
$this->manager->openSubject($subject);
return new RedirectResponse(
$this->generateUrl('claro_forum_subjects', array('category' => $subject->ge... | [
"public",
"function",
"openSubjectAction",
"(",
"Subject",
"$",
"subject",
")",
"{",
"$",
"forum",
"=",
"$",
"subject",
"->",
"getCategory",
"(",
")",
"->",
"getForum",
"(",
")",
";",
"$",
"this",
"->",
"checkAccess",
"(",
"$",
"forum",
")",
";",
"$",
... | @EXT\Route(
"/open/subject/{subject}",
name="claro_subject_open",
options={"expose"=true}
)
@EXT\Method("GET")
@param Subject $subject | [
"@EXT",
"\\",
"Route",
"(",
"/",
"open",
"/",
"subject",
"/",
"{",
"subject",
"}",
"name",
"=",
"claro_subject_open",
"options",
"=",
"{",
"expose",
"=",
"true",
"}",
")",
"@EXT",
"\\",
"Method",
"(",
"GET",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L925-L934 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.replyMessageAction | public function replyMessageAction(Message $message)
{
$subject = $message->getSubject();
$forum = $subject->getCategory()->getForum();
$reply = new Message();
$form = $this->container->get('form.factory')->create(new MessageType, $reply);
$form->handleRequest($this->get('re... | php | public function replyMessageAction(Message $message)
{
$subject = $message->getSubject();
$forum = $subject->getCategory()->getForum();
$reply = new Message();
$form = $this->container->get('form.factory')->create(new MessageType, $reply);
$form->handleRequest($this->get('re... | [
"public",
"function",
"replyMessageAction",
"(",
"Message",
"$",
"message",
")",
"{",
"$",
"subject",
"=",
"$",
"message",
"->",
"getSubject",
"(",
")",
";",
"$",
"forum",
"=",
"$",
"subject",
"->",
"getCategory",
"(",
")",
"->",
"getForum",
"(",
")",
... | @Route(
"/reply/message/{message}",
name="claro_forum_reply_message_form"
)
@ParamConverter("authenticatedUser", options={"authenticatedUser" = true})
@Template("ClarolineForumBundle:Forum:replyMessageForm.html.twig")
@param Message $message | [
"@Route",
"(",
"/",
"reply",
"/",
"message",
"/",
"{",
"message",
"}",
"name",
"=",
"claro_forum_reply_message_form",
")",
"@ParamConverter",
"(",
"authenticatedUser",
"options",
"=",
"{",
"authenticatedUser",
"=",
"true",
"}",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L946-L971 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.activateGlobalNotificationsAction | public function activateGlobalNotificationsAction(Forum $forum)
{
$collection = new ResourceCollection(array($forum->getResourceNode()));
if (!$this->authorization->isGranted('MODERATE', $collection)) {
throw new AccessDeniedException($collection->getErrorsForDisplay());
}
... | php | public function activateGlobalNotificationsAction(Forum $forum)
{
$collection = new ResourceCollection(array($forum->getResourceNode()));
if (!$this->authorization->isGranted('MODERATE', $collection)) {
throw new AccessDeniedException($collection->getErrorsForDisplay());
}
... | [
"public",
"function",
"activateGlobalNotificationsAction",
"(",
"Forum",
"$",
"forum",
")",
"{",
"$",
"collection",
"=",
"new",
"ResourceCollection",
"(",
"array",
"(",
"$",
"forum",
"->",
"getResourceNode",
"(",
")",
")",
")",
";",
"if",
"(",
"!",
"$",
"t... | @Route(
"/{forum}/notifications/activate",
name="claro_forum_activate_global_notifications"
)
@param Forum $forum | [
"@Route",
"(",
"/",
"{",
"forum",
"}",
"/",
"notifications",
"/",
"activate",
"name",
"=",
"claro_forum_activate_global_notifications",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L1019-L1032 |
claroline/ForumBundle | Controller/ForumController.php | ForumController.disableGlobalNotificationsAction | public function disableGlobalNotificationsAction(Forum $forum)
{
$collection = new ResourceCollection(array($forum->getResourceNode()));
if (!$this->authorization->isGranted('MODERATE', $collection)) {
throw new AccessDeniedException($collection->getErrorsForDisplay());
}
... | php | public function disableGlobalNotificationsAction(Forum $forum)
{
$collection = new ResourceCollection(array($forum->getResourceNode()));
if (!$this->authorization->isGranted('MODERATE', $collection)) {
throw new AccessDeniedException($collection->getErrorsForDisplay());
}
... | [
"public",
"function",
"disableGlobalNotificationsAction",
"(",
"Forum",
"$",
"forum",
")",
"{",
"$",
"collection",
"=",
"new",
"ResourceCollection",
"(",
"array",
"(",
"$",
"forum",
"->",
"getResourceNode",
"(",
")",
")",
")",
";",
"if",
"(",
"!",
"$",
"th... | @Route(
"/{forum}/notifications/disable",
name="claro_forum_disable_global_notifications"
)
@param Forum $forum | [
"@Route",
"(",
"/",
"{",
"forum",
"}",
"/",
"notifications",
"/",
"disable",
"name",
"=",
"claro_forum_disable_global_notifications",
")"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Controller/ForumController.php#L1042-L1055 |
anexia-it/anexia-laravel-encryption | src/DatabaseEncryptionScope.php | DatabaseEncryptionScope.apply | public function apply(Builder $builder, Model $model)
{
$encryptedFields = $model::getEncryptedFields();
if (!empty($encryptedFields)) {
$builder->setEncryptionModel($model);
foreach ($encryptedFields as $encryptedField) {
$builder->addEncryptionSelect([
... | php | public function apply(Builder $builder, Model $model)
{
$encryptedFields = $model::getEncryptedFields();
if (!empty($encryptedFields)) {
$builder->setEncryptionModel($model);
foreach ($encryptedFields as $encryptedField) {
$builder->addEncryptionSelect([
... | [
"public",
"function",
"apply",
"(",
"Builder",
"$",
"builder",
",",
"Model",
"$",
"model",
")",
"{",
"$",
"encryptedFields",
"=",
"$",
"model",
"::",
"getEncryptedFields",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"encryptedFields",
")",
")",
"... | Apply the scope to a given Eloquent query builder.
@param \Illuminate\Database\Eloquent\Builder $builder
@param \Illuminate\Database\Eloquent\Model $model
@return void | [
"Apply",
"the",
"scope",
"to",
"a",
"given",
"Eloquent",
"query",
"builder",
"."
] | train | https://github.com/anexia-it/anexia-laravel-encryption/blob/b7c72d99916ebca2d2cf2dbab1d4c0f84e383081/src/DatabaseEncryptionScope.php#L26-L40 |
anexia-it/anexia-laravel-encryption | src/DatabaseEncryptionScope.php | DatabaseEncryptionScope.addWithDecryptKey | protected function addWithDecryptKey(Builder $builder)
{
$builder->macro('withDecryptKey', function (Builder $builder, $decryptKey) {
$model = $builder->getModel();
$encryptedFields = $model::getEncryptedFields();
if (!empty($encryptedFields)) {
$builder->... | php | protected function addWithDecryptKey(Builder $builder)
{
$builder->macro('withDecryptKey', function (Builder $builder, $decryptKey) {
$model = $builder->getModel();
$encryptedFields = $model::getEncryptedFields();
if (!empty($encryptedFields)) {
$builder->... | [
"protected",
"function",
"addWithDecryptKey",
"(",
"Builder",
"$",
"builder",
")",
"{",
"$",
"builder",
"->",
"macro",
"(",
"'withDecryptKey'",
",",
"function",
"(",
"Builder",
"$",
"builder",
",",
"$",
"decryptKey",
")",
"{",
"$",
"model",
"=",
"$",
"buil... | Add the with-decrypt-key extension to the builder.
@param \Illuminate\Database\Eloquent\Builder $builder
@return void | [
"Add",
"the",
"with",
"-",
"decrypt",
"-",
"key",
"extension",
"to",
"the",
"builder",
"."
] | train | https://github.com/anexia-it/anexia-laravel-encryption/blob/b7c72d99916ebca2d2cf2dbab1d4c0f84e383081/src/DatabaseEncryptionScope.php#L61-L81 |
dms-org/package.blog | src/Domain/Entities/BlogCategory.php | BlogCategory.defineEntity | protected function defineEntity(ClassDefinition $class)
{
$class->property($this->name)->asString();
$class->property($this->slug)->asString();
$class->property($this->articles)->asType(BlogArticle::collectionType());
$class->property($this->published)->asBool();
$class->... | php | protected function defineEntity(ClassDefinition $class)
{
$class->property($this->name)->asString();
$class->property($this->slug)->asString();
$class->property($this->articles)->asType(BlogArticle::collectionType());
$class->property($this->published)->asBool();
$class->... | [
"protected",
"function",
"defineEntity",
"(",
"ClassDefinition",
"$",
"class",
")",
"{",
"$",
"class",
"->",
"property",
"(",
"$",
"this",
"->",
"name",
")",
"->",
"asString",
"(",
")",
";",
"$",
"class",
"->",
"property",
"(",
"$",
"this",
"->",
"slug... | Defines the structure of this entity.
@param ClassDefinition $class | [
"Defines",
"the",
"structure",
"of",
"this",
"entity",
"."
] | train | https://github.com/dms-org/package.blog/blob/1500f6fad20d81289a0dfa617fc1c54699f01e16/src/Domain/Entities/BlogCategory.php#L86-L101 |
VincentChalnot/SidusAdminBundle | Twig/AdminExtension.php | AdminExtension.getAdmin | public function getAdmin($code): Admin
{
if ($code instanceof Admin) {
return $code;
}
return $this->adminRegistry->getAdmin($code);
} | php | public function getAdmin($code): Admin
{
if ($code instanceof Admin) {
return $code;
}
return $this->adminRegistry->getAdmin($code);
} | [
"public",
"function",
"getAdmin",
"(",
"$",
"code",
")",
":",
"Admin",
"{",
"if",
"(",
"$",
"code",
"instanceof",
"Admin",
")",
"{",
"return",
"$",
"code",
";",
"}",
"return",
"$",
"this",
"->",
"adminRegistry",
"->",
"getAdmin",
"(",
"$",
"code",
")... | @param string $code
@throws UnexpectedValueException
@return Admin | [
"@param",
"string",
"$code"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Twig/AdminExtension.php#L74-L81 |
neilime/zf2-browscap | src/Browscap/BrowscapService.php | BrowscapService.factory | public static function factory($aOptions){
if($aOptions instanceof \Traversable)$aOptions = \Zend\Stdlib\ArrayUtils::iteratorToArray($aOptions);
elseif(!is_array($aOptions))throw new \InvalidArgumentException(__METHOD__.' expects an array or Traversable object; received "'.(is_object($aOptions)?get_class($aOptions)... | php | public static function factory($aOptions){
if($aOptions instanceof \Traversable)$aOptions = \Zend\Stdlib\ArrayUtils::iteratorToArray($aOptions);
elseif(!is_array($aOptions))throw new \InvalidArgumentException(__METHOD__.' expects an array or Traversable object; received "'.(is_object($aOptions)?get_class($aOptions)... | [
"public",
"static",
"function",
"factory",
"(",
"$",
"aOptions",
")",
"{",
"if",
"(",
"$",
"aOptions",
"instanceof",
"\\",
"Traversable",
")",
"$",
"aOptions",
"=",
"\\",
"Zend",
"\\",
"Stdlib",
"\\",
"ArrayUtils",
"::",
"iteratorToArray",
"(",
"$",
"aOpti... | Instantiate AccessControl Authentication Service
@param array|Traversable $aConfiguration
@param \Zend\ServiceManager\ServiceLocatorInterface $oServiceLocator
@throws \InvalidArgumentException
@return \BoilerAppAccessControl\Authentication\AccessControlAuthenticationService | [
"Instantiate",
"AccessControl",
"Authentication",
"Service"
] | train | https://github.com/neilime/zf2-browscap/blob/490a4d573a2f6340c67a4254d5a46d3276583e1b/src/Browscap/BrowscapService.php#L41-L56 |
neilime/zf2-browscap | src/Browscap/BrowscapService.php | BrowscapService.loadBrowscapIni | public function loadBrowscapIni(){
$sBrowscapIniPath = $this->getBrowscapIniPath();
//Local file
if(is_readable($sBrowscapIniPath)){
$aBrowscap = parse_ini_file($this->getBrowscapIniPath(), true, INI_SCANNER_RAW);
if($aBrowscap === false)throw new \RuntimeException('Error appends while parsing browscap.ini... | php | public function loadBrowscapIni(){
$sBrowscapIniPath = $this->getBrowscapIniPath();
//Local file
if(is_readable($sBrowscapIniPath)){
$aBrowscap = parse_ini_file($this->getBrowscapIniPath(), true, INI_SCANNER_RAW);
if($aBrowscap === false)throw new \RuntimeException('Error appends while parsing browscap.ini... | [
"public",
"function",
"loadBrowscapIni",
"(",
")",
"{",
"$",
"sBrowscapIniPath",
"=",
"$",
"this",
"->",
"getBrowscapIniPath",
"(",
")",
";",
"//Local file",
"if",
"(",
"is_readable",
"(",
"$",
"sBrowscapIniPath",
")",
")",
"{",
"$",
"aBrowscap",
"=",
"parse... | Load and parse browscap.ini file
@throws \RuntimeException
@return \Neilime\Browscap\BrowscapService | [
"Load",
"and",
"parse",
"browscap",
".",
"ini",
"file"
] | train | https://github.com/neilime/zf2-browscap/blob/490a4d573a2f6340c67a4254d5a46d3276583e1b/src/Browscap/BrowscapService.php#L182-L228 |
egeloen/IvorySerializerBundle | Type/FormErrorType.php | FormErrorType.convert | public function convert($data, TypeMetadataInterface $type, ContextInterface $context)
{
if ($context->getDirection() === Direction::DESERIALIZATION) {
throw new \RuntimeException(sprintf('Deserializing a "%s" is not supported.', FormError::class));
}
return $context->getVisitor... | php | public function convert($data, TypeMetadataInterface $type, ContextInterface $context)
{
if ($context->getDirection() === Direction::DESERIALIZATION) {
throw new \RuntimeException(sprintf('Deserializing a "%s" is not supported.', FormError::class));
}
return $context->getVisitor... | [
"public",
"function",
"convert",
"(",
"$",
"data",
",",
"TypeMetadataInterface",
"$",
"type",
",",
"ContextInterface",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"context",
"->",
"getDirection",
"(",
")",
"===",
"Direction",
"::",
"DESERIALIZATION",
")",
"{",... | {@inheritdoc} | [
"{"
] | train | https://github.com/egeloen/IvorySerializerBundle/blob/a2bdd912bf715c61b823cf7257ee232d5c823dd3/Type/FormErrorType.php#L42-L49 |
egeloen/IvorySerializerBundle | Type/FormErrorType.php | FormErrorType.translateError | private function translateError(FormError $error)
{
if ($this->translator === null) {
return $error->getMessage();
}
if ($error->getMessagePluralization() !== null) {
return $this->translator->transChoice(
$error->getMessageTemplate(),
... | php | private function translateError(FormError $error)
{
if ($this->translator === null) {
return $error->getMessage();
}
if ($error->getMessagePluralization() !== null) {
return $this->translator->transChoice(
$error->getMessageTemplate(),
... | [
"private",
"function",
"translateError",
"(",
"FormError",
"$",
"error",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"translator",
"===",
"null",
")",
"{",
"return",
"$",
"error",
"->",
"getMessage",
"(",
")",
";",
"}",
"if",
"(",
"$",
"error",
"->",
"ge... | @param FormError $error
@return string | [
"@param",
"FormError",
"$error"
] | train | https://github.com/egeloen/IvorySerializerBundle/blob/a2bdd912bf715c61b823cf7257ee232d5c823dd3/Type/FormErrorType.php#L56-L76 |
left-right/center | src/controllers/FileController.php | FileController.image | public function image() {
if (Request::hasFile('image') && Request::has('table_name') && Request::has('field_name')) {
return json_encode(self::saveImage(
Request::input('table_name'),
Request::input('field_name'),
Request::file('image'),
null,
Request::file('image')->getClientOriginalExtensi... | php | public function image() {
if (Request::hasFile('image') && Request::has('table_name') && Request::has('field_name')) {
return json_encode(self::saveImage(
Request::input('table_name'),
Request::input('field_name'),
Request::file('image'),
null,
Request::file('image')->getClientOriginalExtensi... | [
"public",
"function",
"image",
"(",
")",
"{",
"if",
"(",
"Request",
"::",
"hasFile",
"(",
"'image'",
")",
"&&",
"Request",
"::",
"has",
"(",
"'table_name'",
")",
"&&",
"Request",
"::",
"has",
"(",
"'field_name'",
")",
")",
"{",
"return",
"json_encode",
... | handle image upload route | [
"handle",
"image",
"upload",
"route"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/FileController.php#L28-L44 |
left-right/center | src/controllers/FileController.php | FileController.saveImage | public static function saveImage($table_name, $field_name, $file_name, $row_id=null, $extension=null) {
//get field info
$table = config('center.tables.' . $table_name);
$field = $table->fields->{$field_name};
$unique = Str::random(5);
//make path
$path = implode('/', [
config('center.files.path'),
... | php | public static function saveImage($table_name, $field_name, $file_name, $row_id=null, $extension=null) {
//get field info
$table = config('center.tables.' . $table_name);
$field = $table->fields->{$field_name};
$unique = Str::random(5);
//make path
$path = implode('/', [
config('center.files.path'),
... | [
"public",
"static",
"function",
"saveImage",
"(",
"$",
"table_name",
",",
"$",
"field_name",
",",
"$",
"file_name",
",",
"$",
"row_id",
"=",
"null",
",",
"$",
"extension",
"=",
"null",
")",
"{",
"//get field info",
"$",
"table",
"=",
"config",
"(",
"'cen... | genericized function to handle upload, available externally via service provider
destroys file after complete | [
"genericized",
"function",
"to",
"handle",
"upload",
"available",
"externally",
"via",
"service",
"provider",
"destroys",
"file",
"after",
"complete"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/FileController.php#L50-L139 |
left-right/center | src/controllers/FileController.php | FileController.getImageDimensions | public static function getImageDimensions($width=false, $height=false) {
$max_width = config('center.img.max.width');
$max_height = config('center.img.max.height');
$max_area = config('center.img.max.area');
//too wide?
if ($width && $width > $max_width) {
if ($height) $height *= $max_width / $width;
... | php | public static function getImageDimensions($width=false, $height=false) {
$max_width = config('center.img.max.width');
$max_height = config('center.img.max.height');
$max_area = config('center.img.max.area');
//too wide?
if ($width && $width > $max_width) {
if ($height) $height *= $max_width / $width;
... | [
"public",
"static",
"function",
"getImageDimensions",
"(",
"$",
"width",
"=",
"false",
",",
"$",
"height",
"=",
"false",
")",
"{",
"$",
"max_width",
"=",
"config",
"(",
"'center.img.max.width'",
")",
";",
"$",
"max_height",
"=",
"config",
"(",
"'center.img.m... | # Get display size for create and edit views | [
"#",
"Get",
"display",
"size",
"for",
"create",
"and",
"edit",
"views"
] | train | https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/FileController.php#L142-L172 |
ppetermann/king23 | src/Http/Router.php | Router.addRoute | public function addRoute($route, $class, $action, $parameters = [], $hostparameters = [])
{
$this->log->debug('adding route : ' . $route . ' to class ' . $class . ' and action ' . $action);
$this->routes[$route] = [
"class" => $class,
"action" => $action,
"parame... | php | public function addRoute($route, $class, $action, $parameters = [], $hostparameters = [])
{
$this->log->debug('adding route : ' . $route . ' to class ' . $class . ' and action ' . $action);
$this->routes[$route] = [
"class" => $class,
"action" => $action,
"parame... | [
"public",
"function",
"addRoute",
"(",
"$",
"route",
",",
"$",
"class",
",",
"$",
"action",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"hostparameters",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"log",
"->",
"debug",
"(",
"'adding route : '",... | add route to list of known routes
@param String $route beginning string of the route
@param String $class to be used for this route
@param String $action method to be called
@param string[] $parameters list of parameters that should be retrieved from url
@param array $hostparameters - allows to use subdomains as param... | [
"add",
"route",
"to",
"list",
"of",
"known",
"routes"
] | train | https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Http/Router.php#L87-L98 |
ppetermann/king23 | src/Http/Router.php | Router.setBaseHost | public function setBaseHost($baseHost = null)
{
$this->log->debug('Setting Router baseHost to ' . $baseHost);
$this->baseHost = $baseHost;
return $this;
} | php | public function setBaseHost($baseHost = null)
{
$this->log->debug('Setting Router baseHost to ' . $baseHost);
$this->baseHost = $baseHost;
return $this;
} | [
"public",
"function",
"setBaseHost",
"(",
"$",
"baseHost",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"log",
"->",
"debug",
"(",
"'Setting Router baseHost to '",
".",
"$",
"baseHost",
")",
";",
"$",
"this",
"->",
"baseHost",
"=",
"$",
"baseHost",
";",
"re... | method to set the basicHost for hostparameters in routing
@see King23_Router::$basicHost
@param String $baseHost
@return self | [
"method",
"to",
"set",
"the",
"basicHost",
"for",
"hostparameters",
"in",
"routing"
] | train | https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Http/Router.php#L107-L112 |
ppetermann/king23 | src/Http/Router.php | Router.handleRoute | private function handleRoute($info, ServerRequestInterface $request, $route) : ResponseInterface
{
// initialize router attributes for the request
$attributes = [
'params' => [
'url' => [],
'host' => []
]
];
// prepare paramete... | php | private function handleRoute($info, ServerRequestInterface $request, $route) : ResponseInterface
{
// initialize router attributes for the request
$attributes = [
'params' => [
'url' => [],
'host' => []
]
];
// prepare paramete... | [
"private",
"function",
"handleRoute",
"(",
"$",
"info",
",",
"ServerRequestInterface",
"$",
"request",
",",
"$",
"route",
")",
":",
"ResponseInterface",
"{",
"// initialize router attributes for the request",
"$",
"attributes",
"=",
"[",
"'params'",
"=>",
"[",
"'url... | Handle a regular route
@param array $info
@param ServerRequestInterface $request
@param string $route
@return ResponseInterface
@throws \King23\Controller\Exceptions\ActionDoesNotExistException | [
"Handle",
"a",
"regular",
"route"
] | train | https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Http/Router.php#L149-L176 |
ppetermann/king23 | src/Http/Router.php | Router.extractHostParameters | private function extractHostParameters($request, $info)
{
$hostname = $this->cleanHostName($request);
if (empty($hostname)) {
$params = [];
} else {
$params = array_reverse(explode(".", $hostname));
}
$parameters = $this->filterParameters($info['host... | php | private function extractHostParameters($request, $info)
{
$hostname = $this->cleanHostName($request);
if (empty($hostname)) {
$params = [];
} else {
$params = array_reverse(explode(".", $hostname));
}
$parameters = $this->filterParameters($info['host... | [
"private",
"function",
"extractHostParameters",
"(",
"$",
"request",
",",
"$",
"info",
")",
"{",
"$",
"hostname",
"=",
"$",
"this",
"->",
"cleanHostName",
"(",
"$",
"request",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"hostname",
")",
")",
"{",
"$",
"p... | extract parameters from hostname
@param ServerRequestInterface $request
@param array $info
@return array | [
"extract",
"parameters",
"from",
"hostname"
] | train | https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Http/Router.php#L203-L215 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.