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 |
|---|---|---|---|---|---|---|---|---|---|---|
mihai-stancu/serializer | Serializer/Normalizer/TypehintNormalizer.php | TypehintNormalizer.normalize | public function normalize($object, $format = null, array $context = array())
{
$data = parent::normalize($object, $format, $context);
if (!is_array($data)) {
return $data;
}
return array_merge($this->getHintFromObject($object), $data);
} | php | public function normalize($object, $format = null, array $context = array())
{
$data = parent::normalize($object, $format, $context);
if (!is_array($data)) {
return $data;
}
return array_merge($this->getHintFromObject($object), $data);
} | [
"public",
"function",
"normalize",
"(",
"$",
"object",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"$",
"data",
"=",
"parent",
"::",
"normalize",
"(",
"$",
"object",
",",
"$",
"format",
",",
"$",... | @param object $object
@param string $format
@param array $context
@return array | [
"@param",
"object",
"$object",
"@param",
"string",
"$format",
"@param",
"array",
"$context"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/TypehintNormalizer.php#L55-L64 |
mihai-stancu/serializer | Serializer/Normalizer/TypehintNormalizer.php | TypehintNormalizer.supportsNormalization | public function supportsNormalization($data, $format = null)
{
if (is_object($data)) {
return parent::supportsNormalization($data, $format);
}
return false;
} | php | public function supportsNormalization($data, $format = null)
{
if (is_object($data)) {
return parent::supportsNormalization($data, $format);
}
return false;
} | [
"public",
"function",
"supportsNormalization",
"(",
"$",
"data",
",",
"$",
"format",
"=",
"null",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"data",
")",
")",
"{",
"return",
"parent",
"::",
"supportsNormalization",
"(",
"$",
"data",
",",
"$",
"format",
... | @param mixed $data
@param string $format
@return bool | [
"@param",
"mixed",
"$data",
"@param",
"string",
"$format"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/TypehintNormalizer.php#L72-L79 |
mihai-stancu/serializer | Serializer/Normalizer/TypehintNormalizer.php | TypehintNormalizer.denormalize | public function denormalize($data, $class, $format = null, array $context = array())
{
if (!($_class = $this->getClassFromArray($data))) {
return parent::denormalize($data, $class, $format, $context);
}
$class = $_class;
return parent::denormalize($data, $class, $format... | php | public function denormalize($data, $class, $format = null, array $context = array())
{
if (!($_class = $this->getClassFromArray($data))) {
return parent::denormalize($data, $class, $format, $context);
}
$class = $_class;
return parent::denormalize($data, $class, $format... | [
"public",
"function",
"denormalize",
"(",
"$",
"data",
",",
"$",
"class",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"_class",
"=",
"$",
"this",
"->",
"getClassFromArra... | @param array $data
@param string $class
@param string $format
@param array $context
@return object | [
"@param",
"array",
"$data",
"@param",
"string",
"$class",
"@param",
"string",
"$format",
"@param",
"array",
"$context"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/TypehintNormalizer.php#L89-L98 |
mihai-stancu/serializer | Serializer/Normalizer/TypehintNormalizer.php | TypehintNormalizer.denormalizeProperty | protected function denormalizeProperty($data, $class, $name, $format = null, array $context = array())
{
if (!($_class = $this->getClassFromArray($data))) {
return parent::denormalizeProperty($data, $class, $name, $format, $context);
}
$class = $_class;
if (!$this->seria... | php | protected function denormalizeProperty($data, $class, $name, $format = null, array $context = array())
{
if (!($_class = $this->getClassFromArray($data))) {
return parent::denormalizeProperty($data, $class, $name, $format, $context);
}
$class = $_class;
if (!$this->seria... | [
"protected",
"function",
"denormalizeProperty",
"(",
"$",
"data",
",",
"$",
"class",
",",
"$",
"name",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"_class",
"=",
"$",
... | @param mixed $data
@param string $class
@param string $name
@param string $format
@param array $context
@throws RuntimeException
@return mixed|object | [
"@param",
"mixed",
"$data",
"@param",
"string",
"$class",
"@param",
"string",
"$name",
"@param",
"string",
"$format",
"@param",
"array",
"$context"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/TypehintNormalizer.php#L111-L124 |
mihai-stancu/serializer | Serializer/Normalizer/TypehintNormalizer.php | TypehintNormalizer.supportsDenormalization | public function supportsDenormalization($data, $type, $format = null)
{
if (!($class = $this->getClassFromArray($data))) {
return parent::supportsDenormalization($data, $type ?: $class, $format);
}
return true;
} | php | public function supportsDenormalization($data, $type, $format = null)
{
if (!($class = $this->getClassFromArray($data))) {
return parent::supportsDenormalization($data, $type ?: $class, $format);
}
return true;
} | [
"public",
"function",
"supportsDenormalization",
"(",
"$",
"data",
",",
"$",
"type",
",",
"$",
"format",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"class",
"=",
"$",
"this",
"->",
"getClassFromArray",
"(",
"$",
"data",
")",
")",
")",
"{",
"r... | @param array $data
@param string $type
@param null $format
@return bool | [
"@param",
"array",
"$data",
"@param",
"string",
"$type",
"@param",
"null",
"$format"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/TypehintNormalizer.php#L133-L140 |
mihai-stancu/serializer | Serializer/Normalizer/TypehintNormalizer.php | TypehintNormalizer.getClassFromArray | protected function getClassFromArray($data)
{
if (!is_array($data)) {
return;
}
if (isset($data['@type']) and $type = $data['@type'] and isset($this->types[$type])) {
$class = $this->types[$type];
}
if (isset($data['@class'])) {
$class = ... | php | protected function getClassFromArray($data)
{
if (!is_array($data)) {
return;
}
if (isset($data['@type']) and $type = $data['@type'] and isset($this->types[$type])) {
$class = $this->types[$type];
}
if (isset($data['@class'])) {
$class = ... | [
"protected",
"function",
"getClassFromArray",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'@type'",
"]",
")",
"and",
"$",
"type",
"=",
"$... | @param mixed $data
@return string | [
"@param",
"mixed",
"$data"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/TypehintNormalizer.php#L147-L164 |
mihai-stancu/serializer | Serializer/Normalizer/TypehintNormalizer.php | TypehintNormalizer.getHintFromObject | protected function getHintFromObject($object)
{
if (!is_object($object)) {
return array();
}
$class = get_class($object);
$type = array_search($class, $this->types);
if ($type) {
return array('@type' => $type);
}
return array('@clas... | php | protected function getHintFromObject($object)
{
if (!is_object($object)) {
return array();
}
$class = get_class($object);
$type = array_search($class, $this->types);
if ($type) {
return array('@type' => $type);
}
return array('@clas... | [
"protected",
"function",
"getHintFromObject",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"class",
"=",
"get_class",
"(",
"$",
"object",
")",
";",
"$",
"t... | @param object $object
@return array | [
"@param",
"object",
"$object"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/TypehintNormalizer.php#L171-L185 |
ClanCats/Core | src/classes/CCView/Builder.php | CCView_Builder.compile | public static function compile( $builder, $view_file )
{
if ( !isset( static::$_view_builders[$builder] ) )
{
throw new CCException( "CCView_Builder - view builder '".$builder."' is not registerd." );
}
$builder = static::$_view_builders[$builder];
if ( !class_exists( $builder ) )
{
throw new C... | php | public static function compile( $builder, $view_file )
{
if ( !isset( static::$_view_builders[$builder] ) )
{
throw new CCException( "CCView_Builder - view builder '".$builder."' is not registerd." );
}
$builder = static::$_view_builders[$builder];
if ( !class_exists( $builder ) )
{
throw new C... | [
"public",
"static",
"function",
"compile",
"(",
"$",
"builder",
",",
"$",
"view_file",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"_view_builders",
"[",
"$",
"builder",
"]",
")",
")",
"{",
"throw",
"new",
"CCException",
"(",
"\"CCView... | Compile the view
@param string $builder
@param string $view_file | [
"Compile",
"the",
"view"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCView/Builder.php#L41-L57 |
haldayne/boost | src/MapOfNumerics.php | MapOfNumerics.increment | public function increment($key, $delta = 1)
{
if ($this->has($key)) {
$this->set(
$key,
$this->get($key) + $delta
);
} else {
$this->set($key, $delta);
}
return $this;
} | php | public function increment($key, $delta = 1)
{
if ($this->has($key)) {
$this->set(
$key,
$this->get($key) + $delta
);
} else {
$this->set($key, $delta);
}
return $this;
} | [
"public",
"function",
"increment",
"(",
"$",
"key",
",",
"$",
"delta",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"get",
"(",
"... | Increment the value stored at the given key by the given delta.
@return $this
@since 1.0.3
@api | [
"Increment",
"the",
"value",
"stored",
"at",
"the",
"given",
"key",
"by",
"the",
"given",
"delta",
"."
] | train | https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/MapOfNumerics.php#L134-L146 |
yuncms/framework | src/models/Volume.php | Volume.getSettingsModel | public function getSettingsModel()
{
/** @var FilesystemAdapter $volumeClass */
$volumeClass = $this->className;
/** @var VolumeSettingsModel $model */
$model = $volumeClass::getSettingsModel();
$model->setVolume($this);
if ($this->configuration) {
$model-... | php | public function getSettingsModel()
{
/** @var FilesystemAdapter $volumeClass */
$volumeClass = $this->className;
/** @var VolumeSettingsModel $model */
$model = $volumeClass::getSettingsModel();
$model->setVolume($this);
if ($this->configuration) {
$model-... | [
"public",
"function",
"getSettingsModel",
"(",
")",
"{",
"/** @var FilesystemAdapter $volumeClass */",
"$",
"volumeClass",
"=",
"$",
"this",
"->",
"className",
";",
"/** @var VolumeSettingsModel $model */",
"$",
"model",
"=",
"$",
"volumeClass",
"::",
"getSettingsModel",
... | 获取渠道设置模型
@return VolumeSettingsModel | [
"获取渠道设置模型"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/models/Volume.php#L109-L120 |
spiral-modules/scaffolder | source/Scaffolder/Declarations/MigrationDeclaration.php | MigrationDeclaration.declareCreation | public function declareCreation(string $table, array $columns)
{
$source = $this->method('up')->getSource();
$source->addLine("\$this->table('{$table}')");
foreach ($columns as $name => $type) {
$source->addLine(" ->addColumn('{$name}', '{$type}')");
}
$sourc... | php | public function declareCreation(string $table, array $columns)
{
$source = $this->method('up')->getSource();
$source->addLine("\$this->table('{$table}')");
foreach ($columns as $name => $type) {
$source->addLine(" ->addColumn('{$name}', '{$type}')");
}
$sourc... | [
"public",
"function",
"declareCreation",
"(",
"string",
"$",
"table",
",",
"array",
"$",
"columns",
")",
"{",
"$",
"source",
"=",
"$",
"this",
"->",
"method",
"(",
"'up'",
")",
"->",
"getSource",
"(",
")",
";",
"$",
"source",
"->",
"addLine",
"(",
"\... | Declare table creation with specific set of columns
@param string $table
@param array $columns | [
"Declare",
"table",
"creation",
"with",
"specific",
"set",
"of",
"columns"
] | train | https://github.com/spiral-modules/scaffolder/blob/9be9dd0da6e4b02232db24e797fe5c288afbbddf/source/Scaffolder/Declarations/MigrationDeclaration.php#L46-L58 |
spiral-modules/scaffolder | source/Scaffolder/Declarations/MigrationDeclaration.php | MigrationDeclaration.declareStructure | private function declareStructure()
{
$up = $this->method('up')->setAccess(MethodDeclaration::ACCESS_PUBLIC);
$down = $this->method('down')->setAccess(MethodDeclaration::ACCESS_PUBLIC);
$up->setComment('Create tables, add columns or insert data here');
$down->setComment('Drop create... | php | private function declareStructure()
{
$up = $this->method('up')->setAccess(MethodDeclaration::ACCESS_PUBLIC);
$down = $this->method('down')->setAccess(MethodDeclaration::ACCESS_PUBLIC);
$up->setComment('Create tables, add columns or insert data here');
$down->setComment('Drop create... | [
"private",
"function",
"declareStructure",
"(",
")",
"{",
"$",
"up",
"=",
"$",
"this",
"->",
"method",
"(",
"'up'",
")",
"->",
"setAccess",
"(",
"MethodDeclaration",
"::",
"ACCESS_PUBLIC",
")",
";",
"$",
"down",
"=",
"$",
"this",
"->",
"method",
"(",
"... | Declare default __invoke method body. | [
"Declare",
"default",
"__invoke",
"method",
"body",
"."
] | train | https://github.com/spiral-modules/scaffolder/blob/9be9dd0da6e4b02232db24e797fe5c288afbbddf/source/Scaffolder/Declarations/MigrationDeclaration.php#L63-L70 |
yuncms/framework | src/actions/UploadAction.php | UploadAction.uploadMore | private function uploadMore(array $files)
{
$res = [];
foreach ($files as $file) {
$result = $this->uploadOne($file);
$res[] = $result;
}
return $res;
} | php | private function uploadMore(array $files)
{
$res = [];
foreach ($files as $file) {
$result = $this->uploadOne($file);
$res[] = $result;
}
return $res;
} | [
"private",
"function",
"uploadMore",
"(",
"array",
"$",
"files",
")",
"{",
"$",
"res",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"uploadOne",
"(",
"$",
"file",
")",
";",
... | 批量上传
@param array $files
@return array
@throws \yii\base\ErrorException | [
"批量上传"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/actions/UploadAction.php#L102-L110 |
yuncms/framework | src/actions/UploadAction.php | UploadAction.uploadOne | private function uploadOne(UploadedFile $file)
{
try {
$validator = new FileValidator([$this->_config]);
if ($validator->validate($file, $error)) {
$fileInfo = $file->save();
$result = [
'name' => Html::encode($fileInfo->filename),
... | php | private function uploadOne(UploadedFile $file)
{
try {
$validator = new FileValidator([$this->_config]);
if ($validator->validate($file, $error)) {
$fileInfo = $file->save();
$result = [
'name' => Html::encode($fileInfo->filename),
... | [
"private",
"function",
"uploadOne",
"(",
"UploadedFile",
"$",
"file",
")",
"{",
"try",
"{",
"$",
"validator",
"=",
"new",
"FileValidator",
"(",
"[",
"$",
"this",
"->",
"_config",
"]",
")",
";",
"if",
"(",
"$",
"validator",
"->",
"validate",
"(",
"$",
... | 单文件上传
@param UploadedFile $file
@return array|mixed
@throws \yii\base\ErrorException | [
"单文件上传"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/actions/UploadAction.php#L118-L146 |
OpenClassrooms/ServiceProxy | src/Proxy/Factory/ProxyFactory.php | ProxyFactory.createProxy | public function createProxy($instance)
{
$proxyClassName = $this->generateProxy(get_class($instance));
/** @var ServiceProxyInterface $proxy */
$proxy = new $proxyClassName();
$proxy->setProxy_RealSubject($instance);
return $proxy;
} | php | public function createProxy($instance)
{
$proxyClassName = $this->generateProxy(get_class($instance));
/** @var ServiceProxyInterface $proxy */
$proxy = new $proxyClassName();
$proxy->setProxy_RealSubject($instance);
return $proxy;
} | [
"public",
"function",
"createProxy",
"(",
"$",
"instance",
")",
"{",
"$",
"proxyClassName",
"=",
"$",
"this",
"->",
"generateProxy",
"(",
"get_class",
"(",
"$",
"instance",
")",
")",
";",
"/** @var ServiceProxyInterface $proxy */",
"$",
"proxy",
"=",
"new",
"$... | {@inheritdoc} | [
"{"
] | train | https://github.com/OpenClassrooms/ServiceProxy/blob/31f9f8be8f064b4ca36873df83fc3833f53da438/src/Proxy/Factory/ProxyFactory.php#L37-L45 |
haldayne/boost | src/MapOfObjects.php | MapOfObjects.apply | public function apply($method, array $args = [])
{
$result = new Map;
$this->walk(function ($object, $key) use ($method, $args, $result) {
$result[$key] = call_user_func_array([$object, $method], $args);
});
return $result;
} | php | public function apply($method, array $args = [])
{
$result = new Map;
$this->walk(function ($object, $key) use ($method, $args, $result) {
$result[$key] = call_user_func_array([$object, $method], $args);
});
return $result;
} | [
"public",
"function",
"apply",
"(",
"$",
"method",
",",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"result",
"=",
"new",
"Map",
";",
"$",
"this",
"->",
"walk",
"(",
"function",
"(",
"$",
"object",
",",
"$",
"key",
")",
"use",
"(",
"$",... | Call the given method on every object in the map, and return the
results as a new map.
@param string $method The method on each contained object to call.
@param array|null $args The arguments to pass to the method.
@return \Haldayne\Boost\Map
@api | [
"Call",
"the",
"given",
"method",
"on",
"every",
"object",
"in",
"the",
"map",
"and",
"return",
"the",
"results",
"as",
"a",
"new",
"map",
"."
] | train | https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/MapOfObjects.php#L18-L25 |
ufocoder/yii2-SyncSocial | src/actions/ConnectAction.php | ConnectAction.run | public function run( $service ) {
return $this->redirectWithMessages(
$this->synchronizer->connect( $service ),
Yii::t( 'SyncSocial', 'Service was successfully connected' ),
Yii::t( 'SyncSocial', 'Service could not be connected' )
);
} | php | public function run( $service ) {
return $this->redirectWithMessages(
$this->synchronizer->connect( $service ),
Yii::t( 'SyncSocial', 'Service was successfully connected' ),
Yii::t( 'SyncSocial', 'Service could not be connected' )
);
} | [
"public",
"function",
"run",
"(",
"$",
"service",
")",
"{",
"return",
"$",
"this",
"->",
"redirectWithMessages",
"(",
"$",
"this",
"->",
"synchronizer",
"->",
"connect",
"(",
"$",
"service",
")",
",",
"Yii",
"::",
"t",
"(",
"'SyncSocial'",
",",
"'Service... | @param $service
@return \yii\web\Response | [
"@param",
"$service"
] | train | https://github.com/ufocoder/yii2-SyncSocial/blob/2dbaaec2dad782c52fdd5b648a31ba7fe2a75e1b/src/actions/ConnectAction.php#L18-L26 |
JoshuaEstes/FeatureToggle | src/JoshuaEstes/Component/FeatureToggle/FeatureContainer.php | FeatureContainer.addFeature | public function addFeature(FeatureInterface $feature)
{
$this->features->set($feature->getKey(), $feature);
return $this;
} | php | public function addFeature(FeatureInterface $feature)
{
$this->features->set($feature->getKey(), $feature);
return $this;
} | [
"public",
"function",
"addFeature",
"(",
"FeatureInterface",
"$",
"feature",
")",
"{",
"$",
"this",
"->",
"features",
"->",
"set",
"(",
"$",
"feature",
"->",
"getKey",
"(",
")",
",",
"$",
"feature",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add a feature to the container
@param FeatureInterface
@return FeatureBag | [
"Add",
"a",
"feature",
"to",
"the",
"container"
] | train | https://github.com/JoshuaEstes/FeatureToggle/blob/d93b95b649acce80a6395d97cd165ba733971d84/src/JoshuaEstes/Component/FeatureToggle/FeatureContainer.php#L58-L63 |
simple-php-mvc/simple-php-mvc | src/MVC/DataBase/DBALModel.php | DBALModel._delete | protected function _delete(array $criteria = array())
{
if (!is_null($this->_table)) {
$this->_affectedRows = $this->_db->delete($this->_table, $criteria);
return $this->_affectedRows;
}
} | php | protected function _delete(array $criteria = array())
{
if (!is_null($this->_table)) {
$this->_affectedRows = $this->_db->delete($this->_table, $criteria);
return $this->_affectedRows;
}
} | [
"protected",
"function",
"_delete",
"(",
"array",
"$",
"criteria",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"_table",
")",
")",
"{",
"$",
"this",
"->",
"_affectedRows",
"=",
"$",
"this",
"->",
"_db",
"->"... | @param array $criteria Criterios de la consulta DELETE adoptados en el WHERE
@return int Filas afectadas | [
"@param",
"array",
"$criteria",
"Criterios",
"de",
"la",
"consulta",
"DELETE",
"adoptados",
"en",
"el",
"WHERE"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/DataBase/DBALModel.php#L106-L112 |
simple-php-mvc/simple-php-mvc | src/MVC/DataBase/DBALModel.php | DBALModel._insert | protected function _insert(array $data = array())
{
if (!is_null($this->_table)) {
$this->_affectedRows = $this->_db->insert($this->_table, $data);
if ($this->_affectedRows > 0) {
$this->id = $this->_db->lastInsertId();
}
return $this->_affecte... | php | protected function _insert(array $data = array())
{
if (!is_null($this->_table)) {
$this->_affectedRows = $this->_db->insert($this->_table, $data);
if ($this->_affectedRows > 0) {
$this->id = $this->_db->lastInsertId();
}
return $this->_affecte... | [
"protected",
"function",
"_insert",
"(",
"array",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"_table",
")",
")",
"{",
"$",
"this",
"->",
"_affectedRows",
"=",
"$",
"this",
"->",
"_db",
"->",
... | @param array $data Arreglo asociativo de los campos a insertar del registro
@return int Filas afectadas | [
"@param",
"array",
"$data",
"Arreglo",
"asociativo",
"de",
"los",
"campos",
"a",
"insertar",
"del",
"registro"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/DataBase/DBALModel.php#L119-L128 |
simple-php-mvc/simple-php-mvc | src/MVC/DataBase/DBALModel.php | DBALModel._join | protected function _join($table, $field_first, $field_second, $operator)
{
$join = "";
#If the parameters are array
if ((is_array($table) && is_array($field_first)) && (is_array($field_second) && is_array($operator))) {
#If the number of keys of the parameters are iquals
... | php | protected function _join($table, $field_first, $field_second, $operator)
{
$join = "";
#If the parameters are array
if ((is_array($table) && is_array($field_first)) && (is_array($field_second) && is_array($operator))) {
#If the number of keys of the parameters are iquals
... | [
"protected",
"function",
"_join",
"(",
"$",
"table",
",",
"$",
"field_first",
",",
"$",
"field_second",
",",
"$",
"operator",
")",
"{",
"$",
"join",
"=",
"\"\"",
";",
"#If the parameters are array",
"if",
"(",
"(",
"is_array",
"(",
"$",
"table",
")",
"&&... | @param mixed $table Tabla(s) para el sentencia INNER JOIN
@param mixed $field_first Primer(os) campo(s). Primer campo en la condición del INNER JOIN
@param mixed $field_second Segundo(os) campo(s). Primer campo en la condición del INNER JOIN
@param mixed $operator Operador(es) para el INNER JOIN.
@return s... | [
"@param",
"mixed",
"$table",
"Tabla",
"(",
"s",
")",
"para",
"el",
"sentencia",
"INNER",
"JOIN",
"@param",
"mixed",
"$field_first",
"Primer",
"(",
"os",
")",
"campo",
"(",
"s",
")",
".",
"Primer",
"campo",
"en",
"la",
"condición",
"del",
"INNER",
"JOIN",... | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/DataBase/DBALModel.php#L139-L158 |
simple-php-mvc/simple-php-mvc | src/MVC/DataBase/DBALModel.php | DBALModel._query | protected function _query($sql = "", array $criteria = array())
{
try {
// Preparar el SQL
$this->_stmt = $this->_db->prepare($sql);
// Agregar los parametros
foreach ($criteria as $param => $value) {
if (is_integer($param)) {
... | php | protected function _query($sql = "", array $criteria = array())
{
try {
// Preparar el SQL
$this->_stmt = $this->_db->prepare($sql);
// Agregar los parametros
foreach ($criteria as $param => $value) {
if (is_integer($param)) {
... | [
"protected",
"function",
"_query",
"(",
"$",
"sql",
"=",
"\"\"",
",",
"array",
"$",
"criteria",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"// Preparar el SQL",
"$",
"this",
"->",
"_stmt",
"=",
"$",
"this",
"->",
"_db",
"->",
"prepare",
"(",
"$",
... | @param string $sql Consulta SQL a la base de datos
@param array $criteria Criterios de la consulta SQL adoptados en el WHERE
@return Statement Retorna el objeto de Doctrine Statement
@throws DBALException Error de Doctrine
@throws Exception Error en el SQL | [
"@param",
"string",
"$sql",
"Consulta",
"SQL",
"a",
"la",
"base",
"de",
"datos",
"@param",
"array",
"$criteria",
"Criterios",
"de",
"la",
"consulta",
"SQL",
"adoptados",
"en",
"el",
"WHERE"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/DataBase/DBALModel.php#L168-L192 |
simple-php-mvc/simple-php-mvc | src/MVC/DataBase/DBALModel.php | DBALModel._select | protected function _select($sql = "", array $join = array(), $where = "", array $criteria = array())
{
if ($this->_sql != $sql)
$this->_sql = $sql;
if (is_array($join)) {
foreach ($join as $currentJoin) {
if (is_array($currentJoin) && count($currentJoin) == 4)... | php | protected function _select($sql = "", array $join = array(), $where = "", array $criteria = array())
{
if ($this->_sql != $sql)
$this->_sql = $sql;
if (is_array($join)) {
foreach ($join as $currentJoin) {
if (is_array($currentJoin) && count($currentJoin) == 4)... | [
"protected",
"function",
"_select",
"(",
"$",
"sql",
"=",
"\"\"",
",",
"array",
"$",
"join",
"=",
"array",
"(",
")",
",",
"$",
"where",
"=",
"\"\"",
",",
"array",
"$",
"criteria",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
... | @param string $sql Sentencia SQL SELECT básica
@param array $join Arreglos de los parámetros del INNER JOIN
@param string $where Sentencia SQL WHERE que identifica la condición de la consulta
@param array $criteria Criterios de la consulta SELECT adoptados en el WHERE
@return array $rows Arreglo asociativo d... | [
"@param",
"string",
"$sql",
"Sentencia",
"SQL",
"SELECT",
"básica",
"@param",
"array",
"$join",
"Arreglos",
"de",
"los",
"parámetros",
"del",
"INNER",
"JOIN",
"@param",
"string",
"$where",
"Sentencia",
"SQL",
"WHERE",
"que",
"identifica",
"la",
"condición",
"de"... | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/DataBase/DBALModel.php#L203-L224 |
simple-php-mvc/simple-php-mvc | src/MVC/DataBase/DBALModel.php | DBALModel._selectFields | protected function _selectFields(array $fields = array(), array $join = array(), $where = "", array $criteria = array())
{
if (empty($fields)) {
$fields = array('*');
}
$this->_sql = "SELECT " . implode(',', $fields) . " FROM $this->_table";
return $this->_select($this->_... | php | protected function _selectFields(array $fields = array(), array $join = array(), $where = "", array $criteria = array())
{
if (empty($fields)) {
$fields = array('*');
}
$this->_sql = "SELECT " . implode(',', $fields) . " FROM $this->_table";
return $this->_select($this->_... | [
"protected",
"function",
"_selectFields",
"(",
"array",
"$",
"fields",
"=",
"array",
"(",
")",
",",
"array",
"$",
"join",
"=",
"array",
"(",
")",
",",
"$",
"where",
"=",
"\"\"",
",",
"array",
"$",
"criteria",
"=",
"array",
"(",
")",
")",
"{",
"if",... | @param array $fields Arreglo de los campos del SELECT a consultar
@param array $join Arreglos de los parámetros del INNER JOIN
@param string $where Sentencia SQL WHERE que identifica la condición de la consulta
@param array $criteria Criterios de la consulta SELECT adoptados en el WHERE
@return array Arreglo ... | [
"@param",
"array",
"$fields",
"Arreglo",
"de",
"los",
"campos",
"del",
"SELECT",
"a",
"consultar",
"@param",
"array",
"$join",
"Arreglos",
"de",
"los",
"parámetros",
"del",
"INNER",
"JOIN",
"@param",
"string",
"$where",
"Sentencia",
"SQL",
"WHERE",
"que",
"ide... | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/DataBase/DBALModel.php#L235-L242 |
simple-php-mvc/simple-php-mvc | src/MVC/DataBase/DBALModel.php | DBALModel._update | protected function _update(array $data = array(), array $criteria = array())
{
if (!is_null($this->_table)) {
$this->_affectedRows = $this->_db->update($this->_table, $data, $criteria);
return $this->_affectedRows;
}
} | php | protected function _update(array $data = array(), array $criteria = array())
{
if (!is_null($this->_table)) {
$this->_affectedRows = $this->_db->update($this->_table, $data, $criteria);
return $this->_affectedRows;
}
} | [
"protected",
"function",
"_update",
"(",
"array",
"$",
"data",
"=",
"array",
"(",
")",
",",
"array",
"$",
"criteria",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"_table",
")",
")",
"{",
"$",
"this",
"->",... | @param array $data Arreglo asociativo de los campos a actualizar del registro
@param array $criteria Criterios de la consulta UPDATE adoptados en el WHERE
@return int Filas afectadas | [
"@param",
"array",
"$data",
"Arreglo",
"asociativo",
"de",
"los",
"campos",
"a",
"actualizar",
"del",
"registro",
"@param",
"array",
"$criteria",
"Criterios",
"de",
"la",
"consulta",
"UPDATE",
"adoptados",
"en",
"el",
"WHERE"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/DataBase/DBALModel.php#L250-L256 |
simple-php-mvc/simple-php-mvc | src/MVC/DataBase/DBALModel.php | DBALModel.getAll | public function getAll(array $fields = array(), array $join = array(), $where = "", array $criteria = array())
{
if (!is_null($this->_table)) {
if (empty($fields)) {
$this->_sql = "SELECT * FROM $this->_table";
return $this->_select($this->_sql, $join, $where, $cr... | php | public function getAll(array $fields = array(), array $join = array(), $where = "", array $criteria = array())
{
if (!is_null($this->_table)) {
if (empty($fields)) {
$this->_sql = "SELECT * FROM $this->_table";
return $this->_select($this->_sql, $join, $where, $cr... | [
"public",
"function",
"getAll",
"(",
"array",
"$",
"fields",
"=",
"array",
"(",
")",
",",
"array",
"$",
"join",
"=",
"array",
"(",
")",
",",
"$",
"where",
"=",
"\"\"",
",",
"array",
"$",
"criteria",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
... | @param array $fields Arreglo de los campos del SELECT a consultar
@param array $join Arreglos de los parámetros del INNER JOIN
@param string $where Sentencia SQL WHERE que identifica la condición de la consulta
@param array $criteria Criterios de la consulta SELECT adoptados en el WHERE
@return array | [
"@param",
"array",
"$fields",
"Arreglo",
"de",
"los",
"campos",
"del",
"SELECT",
"a",
"consultar",
"@param",
"array",
"$join",
"Arreglos",
"de",
"los",
"parámetros",
"del",
"INNER",
"JOIN",
"@param",
"string",
"$where",
"Sentencia",
"SQL",
"WHERE",
"que",
"ide... | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/DataBase/DBALModel.php#L266-L277 |
simple-php-mvc/simple-php-mvc | src/MVC/DataBase/DBALModel.php | DBALModel.getById | public function getById($id)
{
if (!is_null($this->_table) && !is_null($id)) {
$this->_sql = "SELECT * FROM $this->_table WHERE id = $id";
$row = $this->_select($this->_sql);
return (isset($row[0])) ? $row[0] : null;
}
} | php | public function getById($id)
{
if (!is_null($this->_table) && !is_null($id)) {
$this->_sql = "SELECT * FROM $this->_table WHERE id = $id";
$row = $this->_select($this->_sql);
return (isset($row[0])) ? $row[0] : null;
}
} | [
"public",
"function",
"getById",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"_table",
")",
"&&",
"!",
"is_null",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"_sql",
"=",
"\"SELECT * FROM $this->_table WHERE id = ... | @param int $id Id del registro
@return array Arreglo asociativo del registro | [
"@param",
"int",
"$id",
"Id",
"del",
"registro"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/DataBase/DBALModel.php#L284-L291 |
webforge-labs/psc-cms | lib/Psc/Code/AST/DSL.php | DSL.getClosures | public function getClosures() {
if (!isset($this->closures)) {
$cc = new ClosureCompiler();
list($closureCode, $methods) = $cc->compile(new GClass(\Psc\Code\Code::getClass($this)));
unset($methods[array_search('getClosures', $methods)]);
$that = $this;
eval($closureCode);
... | php | public function getClosures() {
if (!isset($this->closures)) {
$cc = new ClosureCompiler();
list($closureCode, $methods) = $cc->compile(new GClass(\Psc\Code\Code::getClass($this)));
unset($methods[array_search('getClosures', $methods)]);
$that = $this;
eval($closureCode);
... | [
"public",
"function",
"getClosures",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"closures",
")",
")",
"{",
"$",
"cc",
"=",
"new",
"ClosureCompiler",
"(",
")",
";",
"list",
"(",
"$",
"closureCode",
",",
"$",
"methods",
")",
"=",... | Gibt für alle Methoden der Klasse eine Closure zurück
extract($dsl->getClosures());
- $parameter defined
- $type defined
- ... usw
@return array (für extract geeignet) | [
"Gibt",
"für",
"alle",
"Methoden",
"der",
"Klasse",
"eine",
"Closure",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/AST/DSL.php#L188-L202 |
atkrad/data-tables | src/Request/Column.php | Column.setSearchable | public function setSearchable($searchable)
{
if ($searchable === 'true') {
$this->searchable = true;
return $this;
}
$this->searchable = false;
return $this;
} | php | public function setSearchable($searchable)
{
if ($searchable === 'true') {
$this->searchable = true;
return $this;
}
$this->searchable = false;
return $this;
} | [
"public",
"function",
"setSearchable",
"(",
"$",
"searchable",
")",
"{",
"if",
"(",
"$",
"searchable",
"===",
"'true'",
")",
"{",
"$",
"this",
"->",
"searchable",
"=",
"true",
";",
"return",
"$",
"this",
";",
"}",
"$",
"this",
"->",
"searchable",
"=",
... | @param string $searchable
@return Column | [
"@param",
"string",
"$searchable"
] | train | https://github.com/atkrad/data-tables/blob/5afcc337ab624ca626e29d9674459c5105982b16/src/Request/Column.php#L48-L58 |
atkrad/data-tables | src/Request/Column.php | Column.setOrderable | public function setOrderable($orderable)
{
if ($orderable === 'true') {
$this->orderable = true;
return $this;
}
$this->orderable = false;
return $this;
} | php | public function setOrderable($orderable)
{
if ($orderable === 'true') {
$this->orderable = true;
return $this;
}
$this->orderable = false;
return $this;
} | [
"public",
"function",
"setOrderable",
"(",
"$",
"orderable",
")",
"{",
"if",
"(",
"$",
"orderable",
"===",
"'true'",
")",
"{",
"$",
"this",
"->",
"orderable",
"=",
"true",
";",
"return",
"$",
"this",
";",
"}",
"$",
"this",
"->",
"orderable",
"=",
"fa... | @param string $orderable
@return Column | [
"@param",
"string",
"$orderable"
] | train | https://github.com/atkrad/data-tables/blob/5afcc337ab624ca626e29d9674459c5105982b16/src/Request/Column.php#L65-L75 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Business/BrandExpander/BrandExpander.php | BrandExpander.expand | public function expand(BrandTransfer $brandTransfer): BrandTransfer
{
foreach ($this->brandTransferExpanderPlugins as $brandTransferExpanderPlugin) {
$brandTransfer = $brandTransferExpanderPlugin->expandTransfer($brandTransfer);
}
return $brandTransfer;
} | php | public function expand(BrandTransfer $brandTransfer): BrandTransfer
{
foreach ($this->brandTransferExpanderPlugins as $brandTransferExpanderPlugin) {
$brandTransfer = $brandTransferExpanderPlugin->expandTransfer($brandTransfer);
}
return $brandTransfer;
} | [
"public",
"function",
"expand",
"(",
"BrandTransfer",
"$",
"brandTransfer",
")",
":",
"BrandTransfer",
"{",
"foreach",
"(",
"$",
"this",
"->",
"brandTransferExpanderPlugins",
"as",
"$",
"brandTransferExpanderPlugin",
")",
"{",
"$",
"brandTransfer",
"=",
"$",
"bran... | @param \Generated\Shared\Transfer\BrandTransfer $brandTransfer
@return \Generated\Shared\Transfer\BrandTransfer | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"BrandTransfer",
"$brandTransfer"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Business/BrandExpander/BrandExpander.php#L27-L34 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/UserManager.php | UserManager.find | public function find(ValueObject $object)
{
try {
if (isset($object->data['username'])) {
$user = $this->userService->loadUserByLogin($object->data['username']);
}
} catch (NotFoundException $notFoundException) {
// We'll throw our own exception la... | php | public function find(ValueObject $object)
{
try {
if (isset($object->data['username'])) {
$user = $this->userService->loadUserByLogin($object->data['username']);
}
} catch (NotFoundException $notFoundException) {
// We'll throw our own exception la... | [
"public",
"function",
"find",
"(",
"ValueObject",
"$",
"object",
")",
"{",
"try",
"{",
"if",
"(",
"isset",
"(",
"$",
"object",
"->",
"data",
"[",
"'username'",
"]",
")",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"userService",
"->",
"loadUserByL... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/UserManager.php#L88-L103 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/UserManager.php | UserManager.create | public function create(ObjectInterface $object)
{
if (!$object instanceof UserObject) {
throw new UnsupportedObjectOperationException(UserObject::class, get_class($object));
}
$this->ensureDefaults($object);
$userCreateStruct = $this->userService->newUserCreateStruct(
... | php | public function create(ObjectInterface $object)
{
if (!$object instanceof UserObject) {
throw new UnsupportedObjectOperationException(UserObject::class, get_class($object));
}
$this->ensureDefaults($object);
$userCreateStruct = $this->userService->newUserCreateStruct(
... | [
"public",
"function",
"create",
"(",
"ObjectInterface",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"UserObject",
")",
"{",
"throw",
"new",
"UnsupportedObjectOperationException",
"(",
"UserObject",
"::",
"class",
",",
"get_class",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/UserManager.php#L108-L138 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/UserManager.php | UserManager.update | public function update(ObjectInterface $object)
{
if (!$object instanceof UserObject) {
throw new UnsupportedObjectOperationException(UserObject::class, get_class($object));
}
$this->ensureDefaults($object);
$user = $this->find($object);
// Populate struct
... | php | public function update(ObjectInterface $object)
{
if (!$object instanceof UserObject) {
throw new UnsupportedObjectOperationException(UserObject::class, get_class($object));
}
$this->ensureDefaults($object);
$user = $this->find($object);
// Populate struct
... | [
"public",
"function",
"update",
"(",
"ObjectInterface",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"UserObject",
")",
"{",
"throw",
"new",
"UnsupportedObjectOperationException",
"(",
"UserObject",
"::",
"class",
",",
"get_class",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/UserManager.php#L143-L167 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/UserManager.php | UserManager.remove | public function remove(ObjectInterface $object)
{
if (!$object instanceof UserObject) {
throw new UnsupportedObjectOperationException(UserObject::class, get_class($object));
}
$user = $this->find($object);
if ($user) {
$this->userService->deleteUser($user);
... | php | public function remove(ObjectInterface $object)
{
if (!$object instanceof UserObject) {
throw new UnsupportedObjectOperationException(UserObject::class, get_class($object));
}
$user = $this->find($object);
if ($user) {
$this->userService->deleteUser($user);
... | [
"public",
"function",
"remove",
"(",
"ObjectInterface",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"UserObject",
")",
"{",
"throw",
"new",
"UnsupportedObjectOperationException",
"(",
"UserObject",
"::",
"class",
",",
"get_class",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/UserManager.php#L190-L203 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/UserManager.php | UserManager.assignUserToUserGroups | protected function assignUserToUserGroups(User $user, array $userGroupObjects)
{
$ezUserGroups = [];
foreach ($userGroupObjects as $userGroup) {
$userGroup = $this->userGroupManager->createOrUpdate($userGroup);
if ($userGroup instanceof UserGroupObject) {
$ezU... | php | protected function assignUserToUserGroups(User $user, array $userGroupObjects)
{
$ezUserGroups = [];
foreach ($userGroupObjects as $userGroup) {
$userGroup = $this->userGroupManager->createOrUpdate($userGroup);
if ($userGroup instanceof UserGroupObject) {
$ezU... | [
"protected",
"function",
"assignUserToUserGroups",
"(",
"User",
"$",
"user",
",",
"array",
"$",
"userGroupObjects",
")",
"{",
"$",
"ezUserGroups",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"userGroupObjects",
"as",
"$",
"userGroup",
")",
"{",
"$",
"userGroup"... | Assigns a collection of Transfer user groups from an eZ user, and returns the once who were added.
@param User $user
@param UserGroupObject[] $userGroupObjects
@return UserGroup[] | [
"Assigns",
"a",
"collection",
"of",
"Transfer",
"user",
"groups",
"from",
"an",
"eZ",
"user",
"and",
"returns",
"the",
"once",
"who",
"were",
"added",
"."
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/UserManager.php#L213-L232 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/UserManager.php | UserManager.unassignUserFromUserGroups | protected function unassignUserFromUserGroups(User $user, array $userGroups)
{
$existingUserGroups = $this->userService->loadUserGroupsOfUser($user);
foreach ($existingUserGroups as $existingUserGroup) {
if (!array_key_exists($existingUserGroup->id, $userGroups)) {
$this-... | php | protected function unassignUserFromUserGroups(User $user, array $userGroups)
{
$existingUserGroups = $this->userService->loadUserGroupsOfUser($user);
foreach ($existingUserGroups as $existingUserGroup) {
if (!array_key_exists($existingUserGroup->id, $userGroups)) {
$this-... | [
"protected",
"function",
"unassignUserFromUserGroups",
"(",
"User",
"$",
"user",
",",
"array",
"$",
"userGroups",
")",
"{",
"$",
"existingUserGroups",
"=",
"$",
"this",
"->",
"userService",
"->",
"loadUserGroupsOfUser",
"(",
"$",
"user",
")",
";",
"foreach",
"... | Unassigns a collection of eZ UserGroups from an eZ User.
@param User $user
@param UserGroup[] $userGroups | [
"Unassigns",
"a",
"collection",
"of",
"eZ",
"UserGroups",
"from",
"an",
"eZ",
"User",
"."
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/UserManager.php#L240-L248 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/UserManager.php | UserManager.getContentType | protected function getContentType(UserObject $object)
{
if (isset($object->data['content_type'])) {
return $this->contentTypeService->loadContentTypeByIdentifier($object->data['content_type']);
}
return;
} | php | protected function getContentType(UserObject $object)
{
if (isset($object->data['content_type'])) {
return $this->contentTypeService->loadContentTypeByIdentifier($object->data['content_type']);
}
return;
} | [
"protected",
"function",
"getContentType",
"(",
"UserObject",
"$",
"object",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"object",
"->",
"data",
"[",
"'content_type'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"contentTypeService",
"->",
"loadContentTypeB... | @param UserObject $object
@return \eZ\Publish\API\Repository\Values\ContentType\ContentType|null | [
"@param",
"UserObject",
"$object"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/UserManager.php#L255-L262 |
turanct/showpad-api | src/Showpad/Authentication.php | Authentication.authenticationStart | public function authenticationStart($redirectUrl)
{
$url = $this->config->getEndpoint();
$url .= '/oauth2/authorize';
$url .= '?client_id=' . $this->config->getClientId();
$url .= '&redirect_uri=' . urlencode($redirectUrl);
$url .= '&response_type=code';
return $url;... | php | public function authenticationStart($redirectUrl)
{
$url = $this->config->getEndpoint();
$url .= '/oauth2/authorize';
$url .= '?client_id=' . $this->config->getClientId();
$url .= '&redirect_uri=' . urlencode($redirectUrl);
$url .= '&response_type=code';
return $url;... | [
"public",
"function",
"authenticationStart",
"(",
"$",
"redirectUrl",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"config",
"->",
"getEndpoint",
"(",
")",
";",
"$",
"url",
".=",
"'/oauth2/authorize'",
";",
"$",
"url",
".=",
"'?client_id='",
".",
"$",
"... | Authentication Start (OAuth2 Step 1)
This method will return the url where users can authenticate our application
@param string $redirectUrl The url where we want to redirect users to (and where we'll catch the OAuth2 code)
@return string | [
"Authentication",
"Start",
"(",
"OAuth2",
"Step",
"1",
")"
] | train | https://github.com/turanct/showpad-api/blob/6b17a2bb3609b3696529014911287688b54bea19/src/Showpad/Authentication.php#L50-L59 |
turanct/showpad-api | src/Showpad/Authentication.php | Authentication.authenticationFinish | public function authenticationFinish($code, $redirectUrl)
{
$resource = $this->config->getEndpoint() . '/oauth2/token';
$parameters = array(
'grant_type' => 'authorization_code',
'code' => $code,
'redirect_uri' => $redirectUrl,
);
// Auth with ba... | php | public function authenticationFinish($code, $redirectUrl)
{
$resource = $this->config->getEndpoint() . '/oauth2/token';
$parameters = array(
'grant_type' => 'authorization_code',
'code' => $code,
'redirect_uri' => $redirectUrl,
);
// Auth with ba... | [
"public",
"function",
"authenticationFinish",
"(",
"$",
"code",
",",
"$",
"redirectUrl",
")",
"{",
"$",
"resource",
"=",
"$",
"this",
"->",
"config",
"->",
"getEndpoint",
"(",
")",
".",
"'/oauth2/token'",
";",
"$",
"parameters",
"=",
"array",
"(",
"'grant_... | Authentication Finish (OAuth2 Step 2)
This method will request our access tokens using the code obtained in step 1
@param string $code The OAuth2 code obtained in step 1
@param string $redirectUrl The url where we want to redirect users to (and where we'll catch the OAuth2 tokens)
@return New token pair | [
"Authentication",
"Finish",
"(",
"OAuth2",
"Step",
"2",
")"
] | train | https://github.com/turanct/showpad-api/blob/6b17a2bb3609b3696529014911287688b54bea19/src/Showpad/Authentication.php#L71-L95 |
turanct/showpad-api | src/Showpad/Authentication.php | Authentication.refreshTokens | public function refreshTokens()
{
$resource = $this->config->getEndpoint() . '/oauth2/token';
$parameters = array(
'grant_type' => 'refresh_token',
'refresh_token' => $this->config->getRefreshToken(),
);
// Auth with basic auth
$data = $this->client-... | php | public function refreshTokens()
{
$resource = $this->config->getEndpoint() . '/oauth2/token';
$parameters = array(
'grant_type' => 'refresh_token',
'refresh_token' => $this->config->getRefreshToken(),
);
// Auth with basic auth
$data = $this->client-... | [
"public",
"function",
"refreshTokens",
"(",
")",
"{",
"$",
"resource",
"=",
"$",
"this",
"->",
"config",
"->",
"getEndpoint",
"(",
")",
".",
"'/oauth2/token'",
";",
"$",
"parameters",
"=",
"array",
"(",
"'grant_type'",
"=>",
"'refresh_token'",
",",
"'refresh... | Refresh tokens
@return array New token pair | [
"Refresh",
"tokens"
] | train | https://github.com/turanct/showpad-api/blob/6b17a2bb3609b3696529014911287688b54bea19/src/Showpad/Authentication.php#L102-L125 |
turanct/showpad-api | src/Showpad/Authentication.php | Authentication.request | public function request($method, $endpoint, array $parameters = null)
{
$url = $this->config->getEndpoint() . $endpoint;
// Client should always send OAuth2 tokens in its headers
$headers = array('Authorization' => 'Bearer ' . $this->config->getAccessToken());
return $this->client-... | php | public function request($method, $endpoint, array $parameters = null)
{
$url = $this->config->getEndpoint() . $endpoint;
// Client should always send OAuth2 tokens in its headers
$headers = array('Authorization' => 'Bearer ' . $this->config->getAccessToken());
return $this->client-... | [
"public",
"function",
"request",
"(",
"$",
"method",
",",
"$",
"endpoint",
",",
"array",
"$",
"parameters",
"=",
"null",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"config",
"->",
"getEndpoint",
"(",
")",
".",
"$",
"endpoint",
";",
"// Client should... | Send an authenticated api request
@param string $method The HTTP method
@param string $endpoint The api endpoint to send the request to
@param array $parameters The parameters for the request (assoc array)
return mixed | [
"Send",
"an",
"authenticated",
"api",
"request"
] | train | https://github.com/turanct/showpad-api/blob/6b17a2bb3609b3696529014911287688b54bea19/src/Showpad/Authentication.php#L136-L144 |
nimix3/Venus | Venus/library/t3rdparty/MiqroDB.php | MiqroTable.delete | public function delete( $options = [] )
{
if( !is_array( $options ) )
throw new MiqroException( 'Parameter $options isn\'t an array', 3 );
$builder = new MiqroBuilder( $this->miqro, 'DELETE FROM $table ' );
$builder->set( 'table', $this->tablename );
if(... | php | public function delete( $options = [] )
{
if( !is_array( $options ) )
throw new MiqroException( 'Parameter $options isn\'t an array', 3 );
$builder = new MiqroBuilder( $this->miqro, 'DELETE FROM $table ' );
$builder->set( 'table', $this->tablename );
if(... | [
"public",
"function",
"delete",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
")",
"throw",
"new",
"MiqroException",
"(",
"'Parameter $options isn\\'t an array'",
",",
"3",
")",
";",
"$",
"builder",
"... | Remove data | [
"Remove",
"data"
] | train | https://github.com/nimix3/Venus/blob/612add7b048bc28553cc58239d46cf88b688d715/Venus/library/t3rdparty/MiqroDB.php#L171-L192 |
GrafiteInc/Mission-Control-Package | src/IssueService.php | IssueService.exception | public function exception($exception)
{
$headers = [
'token' => $this->token,
];
if (is_null($this->token)) {
throw new Exception("Missing token", 1);
}
$query = $this->processException($exception);
$response = $this->curl::post($this->missi... | php | public function exception($exception)
{
$headers = [
'token' => $this->token,
];
if (is_null($this->token)) {
throw new Exception("Missing token", 1);
}
$query = $this->processException($exception);
$response = $this->curl::post($this->missi... | [
"public",
"function",
"exception",
"(",
"$",
"exception",
")",
"{",
"$",
"headers",
"=",
"[",
"'token'",
"=>",
"$",
"this",
"->",
"token",
",",
"]",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"token",
")",
")",
"{",
"throw",
"new",
"Excepti... | Send the exception to Mission control.
@param Exeption $exception
@return bool | [
"Send",
"the",
"exception",
"to",
"Mission",
"control",
"."
] | train | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/IssueService.php#L31-L50 |
GrafiteInc/Mission-Control-Package | src/IssueService.php | IssueService.log | public function log($message, $flag)
{
$headers = [
'token' => $this->token,
];
$query = $this->processLog($message, $flag);
$response = $this->curl::post($this->missionControlUrl, $headers, $query);
if ($response->code != 200) {
$this->error('Unabl... | php | public function log($message, $flag)
{
$headers = [
'token' => $this->token,
];
$query = $this->processLog($message, $flag);
$response = $this->curl::post($this->missionControlUrl, $headers, $query);
if ($response->code != 200) {
$this->error('Unabl... | [
"public",
"function",
"log",
"(",
"$",
"message",
",",
"$",
"flag",
")",
"{",
"$",
"headers",
"=",
"[",
"'token'",
"=>",
"$",
"this",
"->",
"token",
",",
"]",
";",
"$",
"query",
"=",
"$",
"this",
"->",
"processLog",
"(",
"$",
"message",
",",
"$",... | Send the log to Mission Control
@param string $message
@param string $flag
@return bool | [
"Send",
"the",
"log",
"to",
"Mission",
"Control"
] | train | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/IssueService.php#L60-L75 |
GrafiteInc/Mission-Control-Package | src/IssueService.php | IssueService.processException | public function processException($exception)
{
$requestDetails = [
'type' => 'exception',
'data' => json_encode([
'exception_content' => $exception->getMessage() ?? 'No message',
'exception_trace' => $exception->getTrace(),
'exception_f... | php | public function processException($exception)
{
$requestDetails = [
'type' => 'exception',
'data' => json_encode([
'exception_content' => $exception->getMessage() ?? 'No message',
'exception_trace' => $exception->getTrace(),
'exception_f... | [
"public",
"function",
"processException",
"(",
"$",
"exception",
")",
"{",
"$",
"requestDetails",
"=",
"[",
"'type'",
"=>",
"'exception'",
",",
"'data'",
"=>",
"json_encode",
"(",
"[",
"'exception_content'",
"=>",
"$",
"exception",
"->",
"getMessage",
"(",
")"... | Collect data and set report details.
@param Exception $exception
@return array | [
"Collect",
"data",
"and",
"set",
"report",
"details",
"."
] | train | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/IssueService.php#L84-L97 |
GrafiteInc/Mission-Control-Package | src/IssueService.php | IssueService.processLog | public function processLog($message, $flag)
{
$requestDetails = [
'type' => 'log',
'data' => json_encode([
'flag' => $flag,
'message' => $message,
]),
];
return array_merge($this->baseRequest(), $requestDetails);
} | php | public function processLog($message, $flag)
{
$requestDetails = [
'type' => 'log',
'data' => json_encode([
'flag' => $flag,
'message' => $message,
]),
];
return array_merge($this->baseRequest(), $requestDetails);
} | [
"public",
"function",
"processLog",
"(",
"$",
"message",
",",
"$",
"flag",
")",
"{",
"$",
"requestDetails",
"=",
"[",
"'type'",
"=>",
"'log'",
",",
"'data'",
"=>",
"json_encode",
"(",
"[",
"'flag'",
"=>",
"$",
"flag",
",",
"'message'",
"=>",
"$",
"mess... | Collect data and set report details.
@param String $message
@param String $flag
@return array | [
"Collect",
"data",
"and",
"set",
"report",
"details",
"."
] | train | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/IssueService.php#L107-L118 |
GrafiteInc/Mission-Control-Package | src/IssueService.php | IssueService.baseRequest | protected function baseRequest()
{
return [
'report_referer' => $this->server('HTTP_REFERER', ''),
'report_user_agent' => $this->server('HTTP_USER_AGENT', ''),
'report_host' => $this->server('HTTP_HOST', ''),
'report_server_name' => $this->server('SERVER_NAME'... | php | protected function baseRequest()
{
return [
'report_referer' => $this->server('HTTP_REFERER', ''),
'report_user_agent' => $this->server('HTTP_USER_AGENT', ''),
'report_host' => $this->server('HTTP_HOST', ''),
'report_server_name' => $this->server('SERVER_NAME'... | [
"protected",
"function",
"baseRequest",
"(",
")",
"{",
"return",
"[",
"'report_referer'",
"=>",
"$",
"this",
"->",
"server",
"(",
"'HTTP_REFERER'",
",",
"''",
")",
",",
"'report_user_agent'",
"=>",
"$",
"this",
"->",
"server",
"(",
"'HTTP_USER_AGENT'",
",",
... | Collect basic server info
@return array | [
"Collect",
"basic",
"server",
"info"
] | train | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/IssueService.php#L125-L140 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Values/ContentTypeObject.php | ContentTypeObject.setFieldDefinitions | public function setFieldDefinitions(array $fieldDefinitionObjects)
{
$this->data['fields'] = [];
foreach ($fieldDefinitionObjects as $identifier => $fieldDefinitionObject) {
$this->addFieldDefinitionObject($identifier, $fieldDefinitionObject);
}
} | php | public function setFieldDefinitions(array $fieldDefinitionObjects)
{
$this->data['fields'] = [];
foreach ($fieldDefinitionObjects as $identifier => $fieldDefinitionObject) {
$this->addFieldDefinitionObject($identifier, $fieldDefinitionObject);
}
} | [
"public",
"function",
"setFieldDefinitions",
"(",
"array",
"$",
"fieldDefinitionObjects",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'fields'",
"]",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"fieldDefinitionObjects",
"as",
"$",
"identifier",
"=>",
"$",
"field... | Values in array must be of type Location, LocationObject or int.
@param array $fieldDefinitionObjects | [
"Values",
"in",
"array",
"must",
"be",
"of",
"type",
"Location",
"LocationObject",
"or",
"int",
"."
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Values/ContentTypeObject.php#L55-L61 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Values/ContentTypeObject.php | ContentTypeObject.addFieldDefinitionObject | public function addFieldDefinitionObject($identifier, $fieldDefinition)
{
$this->data['fields'][$identifier] = $this->convertToFieldDefintionObject($identifier, $fieldDefinition);
} | php | public function addFieldDefinitionObject($identifier, $fieldDefinition)
{
$this->data['fields'][$identifier] = $this->convertToFieldDefintionObject($identifier, $fieldDefinition);
} | [
"public",
"function",
"addFieldDefinitionObject",
"(",
"$",
"identifier",
",",
"$",
"fieldDefinition",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'fields'",
"]",
"[",
"$",
"identifier",
"]",
"=",
"$",
"this",
"->",
"convertToFieldDefintionObject",
"(",
"$",
... | Convert parameters to FieldDefinitionObject and stores it on the ContentTypeObject.
@param string $identifier
@param array|FieldDefinitionObject $fieldDefinition | [
"Convert",
"parameters",
"to",
"FieldDefinitionObject",
"and",
"stores",
"it",
"on",
"the",
"ContentTypeObject",
"."
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Values/ContentTypeObject.php#L69-L72 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Values/ContentTypeObject.php | ContentTypeObject.setMissingDefaults | private function setMissingDefaults()
{
if (!isset($this->data['contenttype_groups'])) {
$this->data['contenttype_groups'] = array('Content');
}
if ($this->notSetOrEmpty($this->data, 'names')) {
$this->data['names'] = array(
$this->data['main_language... | php | private function setMissingDefaults()
{
if (!isset($this->data['contenttype_groups'])) {
$this->data['contenttype_groups'] = array('Content');
}
if ($this->notSetOrEmpty($this->data, 'names')) {
$this->data['names'] = array(
$this->data['main_language... | [
"private",
"function",
"setMissingDefaults",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'contenttype_groups'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'contenttype_groups'",
"]",
"=",
"array",
"(",
"'Conten... | Build default values. | [
"Build",
"default",
"values",
"."
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Values/ContentTypeObject.php#L77-L94 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Values/ContentTypeObject.php | ContentTypeObject.convertToFieldDefintionObject | private function convertToFieldDefintionObject($identifier, $fieldDefinition)
{
if ($fieldDefinition instanceof FieldDefinitionObject) {
return $fieldDefinition;
} else {
return new FieldDefinitionObject($identifier, $this, $fieldDefinition);
}
} | php | private function convertToFieldDefintionObject($identifier, $fieldDefinition)
{
if ($fieldDefinition instanceof FieldDefinitionObject) {
return $fieldDefinition;
} else {
return new FieldDefinitionObject($identifier, $this, $fieldDefinition);
}
} | [
"private",
"function",
"convertToFieldDefintionObject",
"(",
"$",
"identifier",
",",
"$",
"fieldDefinition",
")",
"{",
"if",
"(",
"$",
"fieldDefinition",
"instanceof",
"FieldDefinitionObject",
")",
"{",
"return",
"$",
"fieldDefinition",
";",
"}",
"else",
"{",
"ret... | @param string $identifier
@param array|FieldDefinitionObject $fieldDefinition
@return FieldDefinitionObject | [
"@param",
"string",
"$identifier",
"@param",
"array|FieldDefinitionObject",
"$fieldDefinition"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Values/ContentTypeObject.php#L155-L162 |
maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/Competitions.php | Competitions.removeTeam | function removeTeam($competitionId, $teamId)
{
if(!$competitionId)
{
throw new Exception('Invalid competitionId');
}
if(!$teamId)
{
throw new Exception('Invalid teamId');
}
return $this->execute('DELETE', '/competitions/%d/teams/%d/', array($competitionId, $teamId));
} | php | function removeTeam($competitionId, $teamId)
{
if(!$competitionId)
{
throw new Exception('Invalid competitionId');
}
if(!$teamId)
{
throw new Exception('Invalid teamId');
}
return $this->execute('DELETE', '/competitions/%d/teams/%d/', array($competitionId, $teamId));
} | [
"function",
"removeTeam",
"(",
"$",
"competitionId",
",",
"$",
"teamId",
")",
"{",
"if",
"(",
"!",
"$",
"competitionId",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Invalid competitionId'",
")",
";",
"}",
"if",
"(",
"!",
"$",
"teamId",
")",
"{",
"thr... | Works only during the registration phase
@param int $competitionId
@param int $teamId
@return type
@throws Exception | [
"Works",
"only",
"during",
"the",
"registration",
"phase"
] | train | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/Competitions.php#L68-L80 |
maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/Competitions.php | Competitions.registerResults | function registerResults($competitionId, array $results)
{
if(!$competitionId)
{
throw new Exception;
}
if(!$results)
{
throw new Exception;
}
return $this->execute('POST', '/competitions/%d/results/', array($competitionId, array($results)));
} | php | function registerResults($competitionId, array $results)
{
if(!$competitionId)
{
throw new Exception;
}
if(!$results)
{
throw new Exception;
}
return $this->execute('POST', '/competitions/%d/results/', array($competitionId, array($results)));
} | [
"function",
"registerResults",
"(",
"$",
"competitionId",
",",
"array",
"$",
"results",
")",
"{",
"if",
"(",
"!",
"$",
"competitionId",
")",
"{",
"throw",
"new",
"Exception",
";",
"}",
"if",
"(",
"!",
"$",
"results",
")",
"{",
"throw",
"new",
"Exceptio... | Register final results of your competition
@param int $competitionId
@param array $results results should be an array with numeric keys from 1 to n, with the team ids as value | [
"Register",
"final",
"results",
"of",
"your",
"competition"
] | train | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/Competitions.php#L169-L180 |
comodojo/cookies | src/Comodojo/Cookies/CookieManager.php | CookieManager.del | public function del($cookie) {
if ( empty($cookie) ) throw new CookieException("Invalid cookie object or name");
$name = ($cookie instanceof CookieInterface) ? $cookie->getName() : $cookie;
if ( $this->isRegistered($name) ) {
unset($this->cookies[$name]);
} else {
... | php | public function del($cookie) {
if ( empty($cookie) ) throw new CookieException("Invalid cookie object or name");
$name = ($cookie instanceof CookieInterface) ? $cookie->getName() : $cookie;
if ( $this->isRegistered($name) ) {
unset($this->cookies[$name]);
} else {
... | [
"public",
"function",
"del",
"(",
"$",
"cookie",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"cookie",
")",
")",
"throw",
"new",
"CookieException",
"(",
"\"Invalid cookie object or name\"",
")",
";",
"$",
"name",
"=",
"(",
"$",
"cookie",
"instanceof",
"CookieI... | Delete a cookie from the stack
@param CookieInterface|string $cookie
@return CookieManager
@throws CookieException | [
"Delete",
"a",
"cookie",
"from",
"the",
"stack"
] | train | https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/CookieManager.php#L69-L83 |
comodojo/cookies | src/Comodojo/Cookies/CookieManager.php | CookieManager.has | public function has($cookie) {
if ( empty($cookie) ) throw new CookieException("Invalid cookie object or name");
$name = ($cookie instanceof CookieInterface) ? $cookie->getName() : $cookie;
return array_key_exists($name, $this->cookies);
} | php | public function has($cookie) {
if ( empty($cookie) ) throw new CookieException("Invalid cookie object or name");
$name = ($cookie instanceof CookieInterface) ? $cookie->getName() : $cookie;
return array_key_exists($name, $this->cookies);
} | [
"public",
"function",
"has",
"(",
"$",
"cookie",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"cookie",
")",
")",
"throw",
"new",
"CookieException",
"(",
"\"Invalid cookie object or name\"",
")",
";",
"$",
"name",
"=",
"(",
"$",
"cookie",
"instanceof",
"CookieI... | Check if a cookie is into the stack
@param CookieInterface|string $cookie
@return CookieManager
@throws CookieException | [
"Check",
"if",
"a",
"cookie",
"is",
"into",
"the",
"stack"
] | train | https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/CookieManager.php#L108-L116 |
comodojo/cookies | src/Comodojo/Cookies/CookieManager.php | CookieManager.getValues | public function getValues() {
$cookies = [];
try {
foreach ( $this->cookies as $name => $cookie ) {
$cookies[$name] = $cookie->getValue();
}
} catch (CookieException $ce) {
throw $ce;
}
return $cookies... | php | public function getValues() {
$cookies = [];
try {
foreach ( $this->cookies as $name => $cookie ) {
$cookies[$name] = $cookie->getValue();
}
} catch (CookieException $ce) {
throw $ce;
}
return $cookies... | [
"public",
"function",
"getValues",
"(",
")",
"{",
"$",
"cookies",
"=",
"[",
"]",
";",
"try",
"{",
"foreach",
"(",
"$",
"this",
"->",
"cookies",
"as",
"$",
"name",
"=>",
"$",
"cookie",
")",
"{",
"$",
"cookies",
"[",
"$",
"name",
"]",
"=",
"$",
"... | Get values from all registered cookies and dump as an associative array
@return array
@throws CookieException | [
"Get",
"values",
"from",
"all",
"registered",
"cookies",
"and",
"dump",
"as",
"an",
"associative",
"array"
] | train | https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/CookieManager.php#L168-L188 |
comodojo/cookies | src/Comodojo/Cookies/CookieManager.php | CookieManager.save | public function save() {
try {
foreach ( $this->cookies as $c ) {
$c->save();
}
} catch (CookieException $ce) {
throw $ce;
}
return true;
} | php | public function save() {
try {
foreach ( $this->cookies as $c ) {
$c->save();
}
} catch (CookieException $ce) {
throw $ce;
}
return true;
} | [
"public",
"function",
"save",
"(",
")",
"{",
"try",
"{",
"foreach",
"(",
"$",
"this",
"->",
"cookies",
"as",
"$",
"c",
")",
"{",
"$",
"c",
"->",
"save",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"CookieException",
"$",
"ce",
")",
"{",
"throw",
"$"... | Save all registered cookies
@return CookieManager
@throws CookieException | [
"Save",
"all",
"registered",
"cookies"
] | train | https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/CookieManager.php#L196-L214 |
comodojo/cookies | src/Comodojo/Cookies/CookieManager.php | CookieManager.load | public function load() {
try {
foreach ( $this->cookies as $c ) {
$c->load();
}
} catch (CookieException $ce) {
throw $ce;
}
return $this;
} | php | public function load() {
try {
foreach ( $this->cookies as $c ) {
$c->load();
}
} catch (CookieException $ce) {
throw $ce;
}
return $this;
} | [
"public",
"function",
"load",
"(",
")",
"{",
"try",
"{",
"foreach",
"(",
"$",
"this",
"->",
"cookies",
"as",
"$",
"c",
")",
"{",
"$",
"c",
"->",
"load",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"CookieException",
"$",
"ce",
")",
"{",
"throw",
"$"... | Load all registered cookies
@return CookieManager
@throws CookieException | [
"Load",
"all",
"registered",
"cookies"
] | train | https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/CookieManager.php#L222-L240 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Entry.php | Zend_Feed_Builder_Entry.addCategory | public function addCategory(array $category)
{
if (empty($category['term'])) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to define the name of the cat... | php | public function addCategory(array $category)
{
if (empty($category['term'])) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to define the name of the cat... | [
"public",
"function",
"addCategory",
"(",
"array",
"$",
"category",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"category",
"[",
"'term'",
"]",
")",
")",
"{",
"/**\n * @see Zend_Feed_Builder_Exception\n */",
"require_once",
"'Zend/Feed/Builder/Except... | Add a category to the entry
@param array $category see Zend_Feed_Builder_Entry::setCategories() for format
@return Zend_Feed_Builder_Entry
@throws Zend_Feed_Builder_Exception | [
"Add",
"a",
"category",
"to",
"the",
"entry"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Entry.php#L221-L239 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Entry.php | Zend_Feed_Builder_Entry.setEnclosures | public function setEnclosures(array $enclosures)
{
foreach ($enclosures as $enclosure) {
if (empty($enclosure['url'])) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
thr... | php | public function setEnclosures(array $enclosures)
{
foreach ($enclosures as $enclosure) {
if (empty($enclosure['url'])) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
thr... | [
"public",
"function",
"setEnclosures",
"(",
"array",
"$",
"enclosures",
")",
"{",
"foreach",
"(",
"$",
"enclosures",
"as",
"$",
"enclosure",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"enclosure",
"[",
"'url'",
"]",
")",
")",
"{",
"/**\n * @se... | Sets the enclosures of the entry
Format of the array:
<code>
array(
array(
'url' => 'url of the linked enclosure',
'type' => 'mime type of the enclosure' // optional
'length' => 'length of the linked content in octets' // optional
),
// second enclosure and so one
)
</code>
@param array $enclosures
@return Zend_Feed_... | [
"Sets",
"the",
"enclosures",
"of",
"the",
"entry",
"Format",
"of",
"the",
"array",
":",
"<code",
">",
"array",
"(",
"array",
"(",
"url",
"=",
">",
"url",
"of",
"the",
"linked",
"enclosure",
"type",
"=",
">",
"mime",
"type",
"of",
"the",
"enclosure",
... | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Entry.php#L259-L274 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Entry.php | Zend_Feed_Builder_Entry.addEnclosure | public function addEnclosure($url, $type = '', $length = '')
{
if (!$this->offsetExists('enclosure')) {
$enclosure = array();
} else {
$enclosure = $this->offsetGet('enclosure');
}
$enclosure[] = array('url' => $url,
'type' => $typ... | php | public function addEnclosure($url, $type = '', $length = '')
{
if (!$this->offsetExists('enclosure')) {
$enclosure = array();
} else {
$enclosure = $this->offsetGet('enclosure');
}
$enclosure[] = array('url' => $url,
'type' => $typ... | [
"public",
"function",
"addEnclosure",
"(",
"$",
"url",
",",
"$",
"type",
"=",
"''",
",",
"$",
"length",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"offsetExists",
"(",
"'enclosure'",
")",
")",
"{",
"$",
"enclosure",
"=",
"array",
"(",
... | Add an enclosure to the entry
@param string $url
@param string $type
@param string $length
@return Zend_Feed_Builder_Entry | [
"Add",
"an",
"enclosure",
"to",
"the",
"entry"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Entry.php#L284-L296 |
Double-Opt-in/php-client-api | src/Client/Commands/Responses/CommandResponse.php | CommandResponse.all | public function all()
{
$result = array();
$data = $this->data();
if ( ! is_array($data))
$data = array($data);
foreach ($data as $entry) {
$result[] = $this->resolveActionFromStdClass($entry);
}
return $result;
} | php | public function all()
{
$result = array();
$data = $this->data();
if ( ! is_array($data))
$data = array($data);
foreach ($data as $entry) {
$result[] = $this->resolveActionFromStdClass($entry);
}
return $result;
} | [
"public",
"function",
"all",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"data",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"$",
"data",
"=",
"array",
"(",
"$",
... | returns a list of all actions
@return array|Action[] | [
"returns",
"a",
"list",
"of",
"all",
"actions"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Commands/Responses/CommandResponse.php#L20-L33 |
Double-Opt-in/php-client-api | src/Client/Commands/Responses/CommandResponse.php | CommandResponse.action | public function action()
{
$action = $this->data();
if ( ! $action instanceof stdClass)
return null;
return $this->resolveActionFromStdClass($action);
} | php | public function action()
{
$action = $this->data();
if ( ! $action instanceof stdClass)
return null;
return $this->resolveActionFromStdClass($action);
} | [
"public",
"function",
"action",
"(",
")",
"{",
"$",
"action",
"=",
"$",
"this",
"->",
"data",
"(",
")",
";",
"if",
"(",
"!",
"$",
"action",
"instanceof",
"stdClass",
")",
"return",
"null",
";",
"return",
"$",
"this",
"->",
"resolveActionFromStdClass",
... | returns the action or null
@return Action|null | [
"returns",
"the",
"action",
"or",
"null"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Commands/Responses/CommandResponse.php#L40-L48 |
webforge-labs/psc-cms | lib/Psc/CMS/Item/Exporter.php | Exporter.merge | public function merge($item, array $interfaces) {
$export = array();
foreach ($interfaces as $interface) {
$export = array_merge($export, $this->$interface($item));
}
return $export;
} | php | public function merge($item, array $interfaces) {
$export = array();
foreach ($interfaces as $interface) {
$export = array_merge($export, $this->$interface($item));
}
return $export;
} | [
"public",
"function",
"merge",
"(",
"$",
"item",
",",
"array",
"$",
"interfaces",
")",
"{",
"$",
"export",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"interfaces",
"as",
"$",
"interface",
")",
"{",
"$",
"export",
"=",
"array_merge",
"(",
"$",
... | wird z.b. vom AbstractEntityController für Autocomplete direkt benutzt
@TODO wir müssen alle Interfaces finden die von den angegebenen Interfaces abgeleitet werden um alles zu exporiteren
z. b. autocompletable exportiert nur die eigenen Properties. Dies muss implizit identifyable hinzufügen | [
"wird",
"z",
".",
"b",
".",
"vom",
"AbstractEntityController",
"für",
"Autocomplete",
"direkt",
"benutzt"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Item/Exporter.php#L110-L116 |
spiral-modules/auth | source/Auth/Operators/SessionOperator.php | SessionOperator.fetchToken | public function fetchToken(Request $request)
{
if (!$this->hasToken($request)) {
return null;
}
return new AuthToken(
'session-auth',
$this->sessionSection($request)->get(static::USER_PK),
$this
);
} | php | public function fetchToken(Request $request)
{
if (!$this->hasToken($request)) {
return null;
}
return new AuthToken(
'session-auth',
$this->sessionSection($request)->get(static::USER_PK),
$this
);
} | [
"public",
"function",
"fetchToken",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasToken",
"(",
"$",
"request",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"AuthToken",
"(",
"'session-auth'",
",",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Operators/SessionOperator.php#L71-L82 |
spiral-modules/auth | source/Auth/Operators/SessionOperator.php | SessionOperator.commitToken | public function commitToken(
Request $request,
Response $response,
TokenInterface $token
): Response {
$this->sessionSection($request)->set(
static::USER_PK,
$token->getUserPK()
);
return $response;
} | php | public function commitToken(
Request $request,
Response $response,
TokenInterface $token
): Response {
$this->sessionSection($request)->set(
static::USER_PK,
$token->getUserPK()
);
return $response;
} | [
"public",
"function",
"commitToken",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"TokenInterface",
"$",
"token",
")",
":",
"Response",
"{",
"$",
"this",
"->",
"sessionSection",
"(",
"$",
"request",
")",
"->",
"set",
"(",
"static"... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Operators/SessionOperator.php#L87-L98 |
spiral-modules/auth | source/Auth/Operators/SessionOperator.php | SessionOperator.removeToken | public function removeToken(
Request $request,
Response $response,
TokenInterface $token
): Response {
$this->sessionSection($request)->clear();
return $response;
} | php | public function removeToken(
Request $request,
Response $response,
TokenInterface $token
): Response {
$this->sessionSection($request)->clear();
return $response;
} | [
"public",
"function",
"removeToken",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"TokenInterface",
"$",
"token",
")",
":",
"Response",
"{",
"$",
"this",
"->",
"sessionSection",
"(",
"$",
"request",
")",
"->",
"clear",
"(",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Operators/SessionOperator.php#L103-L111 |
spiral-modules/auth | source/Auth/Operators/SessionOperator.php | SessionOperator.sessionSection | protected function sessionSection(Request $request): SectionInterface
{
if (empty($request->getAttribute(SessionStarter::ATTRIBUTE))) {
throw new AuthException("Unable to use authorization thought session, no session exists");
}
/** @var SessionInterface $session */
$ses... | php | protected function sessionSection(Request $request): SectionInterface
{
if (empty($request->getAttribute(SessionStarter::ATTRIBUTE))) {
throw new AuthException("Unable to use authorization thought session, no session exists");
}
/** @var SessionInterface $session */
$ses... | [
"protected",
"function",
"sessionSection",
"(",
"Request",
"$",
"request",
")",
":",
"SectionInterface",
"{",
"if",
"(",
"empty",
"(",
"$",
"request",
"->",
"getAttribute",
"(",
"SessionStarter",
"::",
"ATTRIBUTE",
")",
")",
")",
"{",
"throw",
"new",
"AuthEx... | Get session section from given request.
@param Request $request
@return SectionInterface
@throws AuthException When no session is started. | [
"Get",
"session",
"section",
"from",
"given",
"request",
"."
] | train | https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Operators/SessionOperator.php#L121-L131 |
xinix-technology/norm | src/Norm/Cursor/FlatFileCursor.php | FlatFileCursor.current | public function current()
{
if ($this->valid()) {
return $this->collection->attach($this->rows[$this->index]);
}
return null;
} | php | public function current()
{
if ($this->valid()) {
return $this->collection->attach($this->rows[$this->index]);
}
return null;
} | [
"public",
"function",
"current",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"valid",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"collection",
"->",
"attach",
"(",
"$",
"this",
"->",
"rows",
"[",
"$",
"this",
"->",
"index",
"]",
")",
";",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Cursor/FlatFileCursor.php#L33-L40 |
xinix-technology/norm | src/Norm/Cursor/FlatFileCursor.php | FlatFileCursor.execute | protected function execute()
{
$connection = $this->collection->getConnection();
$rows = $connection->getCollectionData($this->collection->getName(), $this->criteria);
$this->rows = array_slice($rows, $this->skip, $this->limit);
foreach ((array) $this->sorts as $field => $flag) {
... | php | protected function execute()
{
$connection = $this->collection->getConnection();
$rows = $connection->getCollectionData($this->collection->getName(), $this->criteria);
$this->rows = array_slice($rows, $this->skip, $this->limit);
foreach ((array) $this->sorts as $field => $flag) {
... | [
"protected",
"function",
"execute",
"(",
")",
"{",
"$",
"connection",
"=",
"$",
"this",
"->",
"collection",
"->",
"getConnection",
"(",
")",
";",
"$",
"rows",
"=",
"$",
"connection",
"->",
"getCollectionData",
"(",
"$",
"this",
"->",
"collection",
"->",
... | Execute a query.
@return void | [
"Execute",
"a",
"query",
"."
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Cursor/FlatFileCursor.php#L65-L83 |
xinix-technology/norm | src/Norm/Cursor/FlatFileCursor.php | FlatFileCursor.valid | public function valid()
{
if (is_null($this->rows)) {
$this->execute();
}
return isset($this->rows[$this->index]);
} | php | public function valid()
{
if (is_null($this->rows)) {
$this->execute();
}
return isset($this->rows[$this->index]);
} | [
"public",
"function",
"valid",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"rows",
")",
")",
"{",
"$",
"this",
"->",
"execute",
"(",
")",
";",
"}",
"return",
"isset",
"(",
"$",
"this",
"->",
"rows",
"[",
"$",
"this",
"->",
"ind... | {@inheritDoc} | [
"{"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Cursor/FlatFileCursor.php#L96-L103 |
xinix-technology/norm | src/Norm/Cursor/FlatFileCursor.php | FlatFileCursor.count | public function count($foundOnly = false)
{
if (is_null($this->rows)) {
$this->execute();
} else if (! $foundOnly) {
$this->limit = null;
$this->skip = null;
$this->criteria = null;
$this->execute();
}
return count($this->... | php | public function count($foundOnly = false)
{
if (is_null($this->rows)) {
$this->execute();
} else if (! $foundOnly) {
$this->limit = null;
$this->skip = null;
$this->criteria = null;
$this->execute();
}
return count($this->... | [
"public",
"function",
"count",
"(",
"$",
"foundOnly",
"=",
"false",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"rows",
")",
")",
"{",
"$",
"this",
"->",
"execute",
"(",
")",
";",
"}",
"else",
"if",
"(",
"!",
"$",
"foundOnly",
")",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Cursor/FlatFileCursor.php#L134-L147 |
yuncms/framework | src/db/ActiveRecord.php | ActiveRecord.toJson | public function toJson(array $fields = [], array $expand = [], $recursive = true)
{
return Json::encode($this->toArray($fields, $expand, $recursive));
} | php | public function toJson(array $fields = [], array $expand = [], $recursive = true)
{
return Json::encode($this->toArray($fields, $expand, $recursive));
} | [
"public",
"function",
"toJson",
"(",
"array",
"$",
"fields",
"=",
"[",
"]",
",",
"array",
"$",
"expand",
"=",
"[",
"]",
",",
"$",
"recursive",
"=",
"true",
")",
"{",
"return",
"Json",
"::",
"encode",
"(",
"$",
"this",
"->",
"toArray",
"(",
"$",
"... | Converts the model into an json.
This method will first identify which fields to be included in the resulting array by calling [[resolveFields()]].
If the model implements the [[Linkable]] interface, the resulting json will also have a `_link` element
which refers to a list of links as specified by the interface.
@pa... | [
"Converts",
"the",
"model",
"into",
"an",
"json",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/db/ActiveRecord.php#L49-L52 |
yuncms/framework | src/db/ActiveRecord.php | ActiveRecord.generateId | public function generateId()
{
$keys = $this->primaryKey();
if (count($keys) === 1) {
$i = rand(0, 9999);
do {
if (9999 == $i) {
$i = 0;
}
$i++;
$id = time() . str_pad($i, 4, '0', STR_PAD_LEFT... | php | public function generateId()
{
$keys = $this->primaryKey();
if (count($keys) === 1) {
$i = rand(0, 9999);
do {
if (9999 == $i) {
$i = 0;
}
$i++;
$id = time() . str_pad($i, 4, '0', STR_PAD_LEFT... | [
"public",
"function",
"generateId",
"(",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"primaryKey",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"keys",
")",
"===",
"1",
")",
"{",
"$",
"i",
"=",
"rand",
"(",
"0",
",",
"9999",
")",
";",
"do"... | 生成流水号
@return int
@throws NotSupportedException | [
"生成流水号"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/db/ActiveRecord.php#L59-L76 |
yuncms/framework | src/db/ActiveRecord.php | ActiveRecord.updateAttributesAsync | public function updateAttributesAsync($attributes)
{
Yii::$app->queue->push(new UpdateActiveRecordAttributesJob([
'modelClass' => get_called_class(),
'condition' => $this->getPrimaryKey(true),
'attributes' => $attributes,
]));
} | php | public function updateAttributesAsync($attributes)
{
Yii::$app->queue->push(new UpdateActiveRecordAttributesJob([
'modelClass' => get_called_class(),
'condition' => $this->getPrimaryKey(true),
'attributes' => $attributes,
]));
} | [
"public",
"function",
"updateAttributesAsync",
"(",
"$",
"attributes",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"queue",
"->",
"push",
"(",
"new",
"UpdateActiveRecordAttributesJob",
"(",
"[",
"'modelClass'",
"=>",
"get_called_class",
"(",
")",
",",
"'condition'"... | 异步更新属性
@param array $attributes
@return int|void | [
"异步更新属性"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/db/ActiveRecord.php#L93-L100 |
yuncms/framework | src/db/ActiveRecord.php | ActiveRecord.updateCountersAsync | public function updateCountersAsync($counters)
{
Yii::$app->queue->push(new UpdateActiveRecordCountersJob([
'modelClass' => get_called_class(),
'condition' => $this->getPrimaryKey(true),
'counters' => $counters,
]));
} | php | public function updateCountersAsync($counters)
{
Yii::$app->queue->push(new UpdateActiveRecordCountersJob([
'modelClass' => get_called_class(),
'condition' => $this->getPrimaryKey(true),
'counters' => $counters,
]));
} | [
"public",
"function",
"updateCountersAsync",
"(",
"$",
"counters",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"queue",
"->",
"push",
"(",
"new",
"UpdateActiveRecordCountersJob",
"(",
"[",
"'modelClass'",
"=>",
"get_called_class",
"(",
")",
",",
"'condition'",
"=... | 异步更新计数器
@param $counters | [
"异步更新计数器"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/db/ActiveRecord.php#L106-L113 |
yuncms/framework | src/db/ActiveRecord.php | ActiveRecord.deleteAsync | public function deleteAsync()
{
Yii::$app->queue->push(new DeleteActiveRecordJob([
'modelClass' => get_called_class(),
'condition' => $this->getPrimaryKey(true)
]));
} | php | public function deleteAsync()
{
Yii::$app->queue->push(new DeleteActiveRecordJob([
'modelClass' => get_called_class(),
'condition' => $this->getPrimaryKey(true)
]));
} | [
"public",
"function",
"deleteAsync",
"(",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"queue",
"->",
"push",
"(",
"new",
"DeleteActiveRecordJob",
"(",
"[",
"'modelClass'",
"=>",
"get_called_class",
"(",
")",
",",
"'condition'",
"=>",
"$",
"this",
"->",
"getPr... | 异步删除 | [
"异步删除"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/db/ActiveRecord.php#L118-L124 |
yuncms/framework | src/db/ActiveRecord.php | ActiveRecord.create | public static function create(array $attributes, $runValidation = true)
{
$model = new static();
$model->loadDefaultValues();
$model->load($attributes, '');
$model->save($runValidation);
return $model;
} | php | public static function create(array $attributes, $runValidation = true)
{
$model = new static();
$model->loadDefaultValues();
$model->load($attributes, '');
$model->save($runValidation);
return $model;
} | [
"public",
"static",
"function",
"create",
"(",
"array",
"$",
"attributes",
",",
"$",
"runValidation",
"=",
"true",
")",
"{",
"$",
"model",
"=",
"new",
"static",
"(",
")",
";",
"$",
"model",
"->",
"loadDefaultValues",
"(",
")",
";",
"$",
"model",
"->",
... | 快速创建实例
@param array $attributes
@param boolean $runValidation
@return ActiveRecord | [
"快速创建实例"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/db/ActiveRecord.php#L132-L139 |
yuncms/framework | src/db/ActiveRecord.php | ActiveRecord.createAsync | public static function createAsync(array $attributes, $runValidation = true)
{
if ($runValidation) {
$model = new static();
$model->loadDefaultValues();
$model->load($attributes, '');
if (!$model->validate()) {
return $model;
}
... | php | public static function createAsync(array $attributes, $runValidation = true)
{
if ($runValidation) {
$model = new static();
$model->loadDefaultValues();
$model->load($attributes, '');
if (!$model->validate()) {
return $model;
}
... | [
"public",
"static",
"function",
"createAsync",
"(",
"array",
"$",
"attributes",
",",
"$",
"runValidation",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"runValidation",
")",
"{",
"$",
"model",
"=",
"new",
"static",
"(",
")",
";",
"$",
"model",
"->",
"loadDef... | 快速创建实例
@param array $attributes
@param boolean $runValidation
@return bool|ActiveRecord | [
"快速创建实例"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/db/ActiveRecord.php#L147-L163 |
yuncms/framework | src/db/ActiveRecord.php | ActiveRecord.updateAllAsync | public static function updateAllAsync($attributes, $condition = '', $params = [])
{
Yii::$app->queue->push(new UpdateActiveRecordAllJob([
'modelClass' => get_called_class(),
'condition' => $condition,
'attributes' => $attributes,
'params' => $params
])... | php | public static function updateAllAsync($attributes, $condition = '', $params = [])
{
Yii::$app->queue->push(new UpdateActiveRecordAllJob([
'modelClass' => get_called_class(),
'condition' => $condition,
'attributes' => $attributes,
'params' => $params
])... | [
"public",
"static",
"function",
"updateAllAsync",
"(",
"$",
"attributes",
",",
"$",
"condition",
"=",
"''",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"queue",
"->",
"push",
"(",
"new",
"UpdateActiveRecordAllJob",
"(",
... | 异步更新全表
@param array $attributes
@param string|array $condition
@param array $params the parameters (name => value) to be bound to the query. | [
"异步更新全表"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/db/ActiveRecord.php#L171-L179 |
yuncms/framework | src/db/ActiveRecord.php | ActiveRecord.updateAllCountersAsync | public static function updateAllCountersAsync($counters, $condition = '', $params = [])
{
Yii::$app->queue->push(new UpdateActiveRecordAllCountersJob([
'modelClass' => get_called_class(),
'condition' => $condition,
'counters' => $counters,
'params' => $params
... | php | public static function updateAllCountersAsync($counters, $condition = '', $params = [])
{
Yii::$app->queue->push(new UpdateActiveRecordAllCountersJob([
'modelClass' => get_called_class(),
'condition' => $condition,
'counters' => $counters,
'params' => $params
... | [
"public",
"static",
"function",
"updateAllCountersAsync",
"(",
"$",
"counters",
",",
"$",
"condition",
"=",
"''",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"queue",
"->",
"push",
"(",
"new",
"UpdateActiveRecordAllCountersJ... | 异步更新计数器
@param array $counters
@param string $condition
@param array $params the parameters (name => value) to be bound to the query. | [
"异步更新计数器"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/db/ActiveRecord.php#L187-L195 |
yuncms/framework | src/db/ActiveRecord.php | ActiveRecord.deleteAllAsync | public static function deleteAllAsync($condition = null, $params = [])
{
Yii::$app->queue->push(new DeleteAllActiveRecordJob([
'modelClass' => get_called_class(),
'condition' => $condition,
'params' => $params
]));
} | php | public static function deleteAllAsync($condition = null, $params = [])
{
Yii::$app->queue->push(new DeleteAllActiveRecordJob([
'modelClass' => get_called_class(),
'condition' => $condition,
'params' => $params
]));
} | [
"public",
"static",
"function",
"deleteAllAsync",
"(",
"$",
"condition",
"=",
"null",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"queue",
"->",
"push",
"(",
"new",
"DeleteAllActiveRecordJob",
"(",
"[",
"'modelClass'",
"=>... | 异步删除
@param string|array $condition
@param array $params | [
"异步删除"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/db/ActiveRecord.php#L202-L209 |
ClanCats/Core | src/classes/CCConfig.php | CCConfig.create | public static function create( $name = null, $driver = 'file' )
{
if ( is_null( $name ) )
{
return new static( null, $driver );
}
if ( !isset( static::$instances[$name] ) )
{
static::$instances[$name] = new static( $name, $driver );
}
return static::$instances[$name];
} | php | public static function create( $name = null, $driver = 'file' )
{
if ( is_null( $name ) )
{
return new static( null, $driver );
}
if ( !isset( static::$instances[$name] ) )
{
static::$instances[$name] = new static( $name, $driver );
}
return static::$instances[$name];
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"driver",
"=",
"'file'",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"name",
")",
")",
"{",
"return",
"new",
"static",
"(",
"null",
",",
"$",
"driver",
")",
";",
"}"... | Create a configuration instance
@param string $name
@return CCConfig | [
"Create",
"a",
"configuration",
"instance"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCConfig.php#L28-L41 |
ClanCats/Core | src/classes/CCConfig.php | CCConfig.driver | public function driver( $driver )
{
$driver = CCCORE_NAMESPACE.'\\'.'CCConfig_'.ucfirst( $driver );
if ( !class_exists( $driver ) )
{
throw new \InvalidArgumentException("CCConfig - Invalid driver '".$driver."'");
}
$this->_driver = new $driver;
} | php | public function driver( $driver )
{
$driver = CCCORE_NAMESPACE.'\\'.'CCConfig_'.ucfirst( $driver );
if ( !class_exists( $driver ) )
{
throw new \InvalidArgumentException("CCConfig - Invalid driver '".$driver."'");
}
$this->_driver = new $driver;
} | [
"public",
"function",
"driver",
"(",
"$",
"driver",
")",
"{",
"$",
"driver",
"=",
"CCCORE_NAMESPACE",
".",
"'\\\\'",
".",
"'CCConfig_'",
".",
"ucfirst",
"(",
"$",
"driver",
")",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"driver",
")",
")",
"{",
... | Set the configuration dirver
@param string $driver
@return void | [
"Set",
"the",
"configuration",
"dirver"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCConfig.php#L77-L87 |
ClanCats/Core | src/classes/CCConfig.php | CCConfig.name | public function name( $name = null )
{
if ( is_null( $name ) )
{
return $this->_instance_name;
}
$this->_instance_name = $name;
} | php | public function name( $name = null )
{
if ( is_null( $name ) )
{
return $this->_instance_name;
}
$this->_instance_name = $name;
} | [
"public",
"function",
"name",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_instance_name",
";",
"}",
"$",
"this",
"->",
"_instance_name",
"=",
"$",
"name",
";",
"}"
] | Name getter and setter
@param string $name
@return string | [
"Name",
"getter",
"and",
"setter"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCConfig.php#L95-L103 |
ClanCats/Core | src/classes/CCConfig.php | CCConfig.write | public function write( $driver = null )
{
if ( empty( $this->_instance_name ) )
{
throw new CCException("CCConfig::write - configuration name is missing.");
}
// set the dirver
if ( !is_null( $driver ) )
{
$this->driver( $driver );
}
// run write
$this->_driver->write( $this->_instance... | php | public function write( $driver = null )
{
if ( empty( $this->_instance_name ) )
{
throw new CCException("CCConfig::write - configuration name is missing.");
}
// set the dirver
if ( !is_null( $driver ) )
{
$this->driver( $driver );
}
// run write
$this->_driver->write( $this->_instance... | [
"public",
"function",
"write",
"(",
"$",
"driver",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_instance_name",
")",
")",
"{",
"throw",
"new",
"CCException",
"(",
"\"CCConfig::write - configuration name is missing.\"",
")",
";",
"}",
... | save a configuration file
this method overwrites your configuration file!!
@param string $name
@return bool | [
"save",
"a",
"configuration",
"file",
"this",
"method",
"overwrites",
"your",
"configuration",
"file!!"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCConfig.php#L124-L139 |
ClanCats/Core | src/classes/CCConfig.php | CCConfig._delete | public function _delete()
{
if ( empty( $this->_instance_name ) )
{
throw new CCException("CCConfig::write - configuration name is missing.");
}
return $this->_driver->delete( $this->_instance_name );
} | php | public function _delete()
{
if ( empty( $this->_instance_name ) )
{
throw new CCException("CCConfig::write - configuration name is missing.");
}
return $this->_driver->delete( $this->_instance_name );
} | [
"public",
"function",
"_delete",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_instance_name",
")",
")",
"{",
"throw",
"new",
"CCException",
"(",
"\"CCConfig::write - configuration name is missing.\"",
")",
";",
"}",
"return",
"$",
"this",
"->",... | Delete the entire configuration
Attention with this one he can be evil!
@param string $name
@return void | [
"Delete",
"the",
"entire",
"configuration",
"Attention",
"with",
"this",
"one",
"he",
"can",
"be",
"evil!"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCConfig.php#L148-L156 |
dashifen/wordpress-php7-plugin-boilerplate | src/Controller/ControllerTraits/TaxonomiesTrait.php | TaxonomiesTrait.getTaxonomy | final public function getTaxonomy(int $index): string {
$taxonomies = $this->getTaxonomies();
if ($index >= sizeof($taxonomies)) {
throw new ControllerException("Unknown taxonomy",
ControllerException::UNKNOWN_TAX);
}
return $taxonomies[$index];
} | php | final public function getTaxonomy(int $index): string {
$taxonomies = $this->getTaxonomies();
if ($index >= sizeof($taxonomies)) {
throw new ControllerException("Unknown taxonomy",
ControllerException::UNKNOWN_TAX);
}
return $taxonomies[$index];
} | [
"final",
"public",
"function",
"getTaxonomy",
"(",
"int",
"$",
"index",
")",
":",
"string",
"{",
"$",
"taxonomies",
"=",
"$",
"this",
"->",
"getTaxonomies",
"(",
")",
";",
"if",
"(",
"$",
"index",
">=",
"sizeof",
"(",
"$",
"taxonomies",
")",
")",
"{"... | Given an index, return that taxonomy from the list of taxonomies
provided by getTaxonomies(). It is recommended to specify a const
value for each taxonomy to avoid errors.
@param int $index
@return string
@throws ControllerException | [
"Given",
"an",
"index",
"return",
"that",
"taxonomy",
"from",
"the",
"list",
"of",
"taxonomies",
"provided",
"by",
"getTaxonomies",
"()",
".",
"It",
"is",
"recommended",
"to",
"specify",
"a",
"const",
"value",
"for",
"each",
"taxonomy",
"to",
"avoid",
"error... | train | https://github.com/dashifen/wordpress-php7-plugin-boilerplate/blob/c7875deb403d311efca72dc3c8beb566972a56cb/src/Controller/ControllerTraits/TaxonomiesTrait.php#L26-L34 |
dashifen/wordpress-php7-plugin-boilerplate | src/Controller/ControllerTraits/TaxonomiesTrait.php | TaxonomiesTrait.initTaxonomiesTrait | final protected function initTaxonomiesTrait(): void {
// notice that this action is added at the 15th priority. since
// taxonomies and post types are used in conjuction with each other,
// we want to be sure that our types are registered before we start
// to link taxonomies to them. so, the PostTypesTra... | php | final protected function initTaxonomiesTrait(): void {
// notice that this action is added at the 15th priority. since
// taxonomies and post types are used in conjuction with each other,
// we want to be sure that our types are registered before we start
// to link taxonomies to them. so, the PostTypesTra... | [
"final",
"protected",
"function",
"initTaxonomiesTrait",
"(",
")",
":",
"void",
"{",
"// notice that this action is added at the 15th priority. since",
"// taxonomies and post types are used in conjuction with each other,",
"// we want to be sure that our types are registered before we start"... | Initializes this trait and registers these taxonomies using the
appropriate WordPress action hook.
@return void | [
"Initializes",
"this",
"trait",
"and",
"registers",
"these",
"taxonomies",
"using",
"the",
"appropriate",
"WordPress",
"action",
"hook",
"."
] | train | https://github.com/dashifen/wordpress-php7-plugin-boilerplate/blob/c7875deb403d311efca72dc3c8beb566972a56cb/src/Controller/ControllerTraits/TaxonomiesTrait.php#L84-L98 |
dashifen/wordpress-php7-plugin-boilerplate | src/Controller/ControllerTraits/TaxonomiesTrait.php | TaxonomiesTrait.registerTaxonomy | final public function registerTaxonomy(string $taxonomy): void {
// this method is public since it's likely that the Activator of a
// plugin will want to register taxonomies and then flush the rewrite
// rules to update permalinks.
$args = $this->getTaxonomyArgs($taxonomy);
$args["labels"] = $this->get... | php | final public function registerTaxonomy(string $taxonomy): void {
// this method is public since it's likely that the Activator of a
// plugin will want to register taxonomies and then flush the rewrite
// rules to update permalinks.
$args = $this->getTaxonomyArgs($taxonomy);
$args["labels"] = $this->get... | [
"final",
"public",
"function",
"registerTaxonomy",
"(",
"string",
"$",
"taxonomy",
")",
":",
"void",
"{",
"// this method is public since it's likely that the Activator of a",
"// plugin will want to register taxonomies and then flush the rewrite",
"// rules to update permalinks.",
"$"... | Given the the name of a taxonomy, accumulates the arguments for the
WordPress register_taxonomy() function and then calls it.
@param string $taxonomy
@return void | [
"Given",
"the",
"the",
"name",
"of",
"a",
"taxonomy",
"accumulates",
"the",
"arguments",
"for",
"the",
"WordPress",
"register_taxonomy",
"()",
"function",
"and",
"then",
"calls",
"it",
"."
] | train | https://github.com/dashifen/wordpress-php7-plugin-boilerplate/blob/c7875deb403d311efca72dc3c8beb566972a56cb/src/Controller/ControllerTraits/TaxonomiesTrait.php#L108-L119 |
yuncms/framework | migrations/m180210_111034_create_cache_table.php | m180210_111034_create_cache_table.safeUp | public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=Inn... | php | public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=Inn... | [
"public",
"function",
"safeUp",
"(",
")",
"{",
"$",
"tableOptions",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"db",
"->",
"driverName",
"===",
"'mysql'",
")",
"{",
"// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-... | {@inheritdoc} | [
"{"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/migrations/m180210_111034_create_cache_table.php#L18-L32 |
ppetermann/king23 | src/Mongo/MongoObject.php | MongoObject.refresh | public function refresh()
{
if ($data = $this->myCollection->findOne(['_id' => $this->myData['_id']])) {
$this->myData = $data;
}
} | php | public function refresh()
{
if ($data = $this->myCollection->findOne(['_id' => $this->myData['_id']])) {
$this->myData = $data;
}
} | [
"public",
"function",
"refresh",
"(",
")",
"{",
"if",
"(",
"$",
"data",
"=",
"$",
"this",
"->",
"myCollection",
"->",
"findOne",
"(",
"[",
"'_id'",
"=>",
"$",
"this",
"->",
"myData",
"[",
"'_id'",
"]",
"]",
")",
")",
"{",
"$",
"this",
"->",
"myDa... | refreshes object from database (all changes be lost!)
@return void | [
"refreshes",
"object",
"from",
"database",
"(",
"all",
"changes",
"be",
"lost!",
")"
] | train | https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Mongo/MongoObject.php#L122-L127 |
VincentChalnot/SidusEAVFilterBundle | Filter/Type/ChoiceFilterType.php | ChoiceFilterType.getFormOptions | public function getFormOptions(QueryHandlerInterface $queryHandler, FilterInterface $filter): array
{
if (!$queryHandler instanceof EAVQueryHandlerInterface) {
throw new BadQueryHandlerException($queryHandler, EAVQueryHandlerInterface::class);
}
if (!$queryHandler->isEAVFilter($f... | php | public function getFormOptions(QueryHandlerInterface $queryHandler, FilterInterface $filter): array
{
if (!$queryHandler instanceof EAVQueryHandlerInterface) {
throw new BadQueryHandlerException($queryHandler, EAVQueryHandlerInterface::class);
}
if (!$queryHandler->isEAVFilter($f... | [
"public",
"function",
"getFormOptions",
"(",
"QueryHandlerInterface",
"$",
"queryHandler",
",",
"FilterInterface",
"$",
"filter",
")",
":",
"array",
"{",
"if",
"(",
"!",
"$",
"queryHandler",
"instanceof",
"EAVQueryHandlerInterface",
")",
"{",
"throw",
"new",
"BadQ... | {@inheritdoc} | [
"{"
] | train | https://github.com/VincentChalnot/SidusEAVFilterBundle/blob/25a9e0495fae30cb96ecded56c50cf7fe70c9032/Filter/Type/ChoiceFilterType.php#L19-L55 |
VincentChalnot/SidusEAVFilterBundle | Filter/Type/ChoiceFilterType.php | ChoiceFilterType.applyAttributeQueryBuilder | protected function applyAttributeQueryBuilder(
AttributeQueryBuilderInterface $attributeQb,
$data
): AttributeQueryBuilderInterface {
if (\is_array($data)) {
return $attributeQb->in($data);
}
return $attributeQb->equals($data);
} | php | protected function applyAttributeQueryBuilder(
AttributeQueryBuilderInterface $attributeQb,
$data
): AttributeQueryBuilderInterface {
if (\is_array($data)) {
return $attributeQb->in($data);
}
return $attributeQb->equals($data);
} | [
"protected",
"function",
"applyAttributeQueryBuilder",
"(",
"AttributeQueryBuilderInterface",
"$",
"attributeQb",
",",
"$",
"data",
")",
":",
"AttributeQueryBuilderInterface",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"return",
"$",
"attri... | @param AttributeQueryBuilderInterface $attributeQb
@param mixed $data
@return AttributeQueryBuilderInterface | [
"@param",
"AttributeQueryBuilderInterface",
"$attributeQb",
"@param",
"mixed",
"$data"
] | train | https://github.com/VincentChalnot/SidusEAVFilterBundle/blob/25a9e0495fae30cb96ecded56c50cf7fe70c9032/Filter/Type/ChoiceFilterType.php#L63-L72 |
fyuze/framework | src/Fyuze/Routing/Matcher.php | Matcher.compileRegex | public function compileRegex()
{
$route = $this->route->getUri();
if (strpos($route, '?')) {
$route = preg_replace('@\/{([\w]+)\?}@', '(?:/{$1})?', $route);
}
$route = preg_replace('/{([a-z0-9_-]+)}/i', '(?P<$1>[^/]+)', $route);
if(substr($route, -1) === '/') {... | php | public function compileRegex()
{
$route = $this->route->getUri();
if (strpos($route, '?')) {
$route = preg_replace('@\/{([\w]+)\?}@', '(?:/{$1})?', $route);
}
$route = preg_replace('/{([a-z0-9_-]+)}/i', '(?P<$1>[^/]+)', $route);
if(substr($route, -1) === '/') {... | [
"public",
"function",
"compileRegex",
"(",
")",
"{",
"$",
"route",
"=",
"$",
"this",
"->",
"route",
"->",
"getUri",
"(",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"route",
",",
"'?'",
")",
")",
"{",
"$",
"route",
"=",
"preg_replace",
"(",
"'@\\/{([\... | Returns the regex needed to match the route.
@access public
@return string | [
"Returns",
"the",
"regex",
"needed",
"to",
"match",
"the",
"route",
"."
] | train | https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Routing/Matcher.php#L55-L70 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/Relations/HasManyThrough.php | HasManyThrough.setDefaultOptions | protected function setDefaultOptions(array $options=[])
{
if (isset($options['intermediate_model'])) {
$intermediateModel = $options['intermediate_model'];
} else {
$this->text['intermediate_text'] = "[".$this->command->paintString('intermediate model' ,'brown')."]";
$intermediateModel = $this->manager->g... | php | protected function setDefaultOptions(array $options=[])
{
if (isset($options['intermediate_model'])) {
$intermediateModel = $options['intermediate_model'];
} else {
$this->text['intermediate_text'] = "[".$this->command->paintString('intermediate model' ,'brown')."]";
$intermediateModel = $this->manager->g... | [
"protected",
"function",
"setDefaultOptions",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'intermediate_model'",
"]",
")",
")",
"{",
"$",
"intermediateModel",
"=",
"$",
"options",
"[",
"'intermediat... | set default options
@param array $options
@return void | [
"set",
"default",
"options"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Relations/HasManyThrough.php#L16-L34 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/Relations/HasManyThrough.php | HasManyThrough.stylingText | protected function stylingText()
{
$this->text['first_key'] = "[".$this->command->paintString($this->defaultOptions['first_key'] ,'green')."]";
$this->text['second_key'] = "[".$this->command->paintString($this->defaultOptions['second_key'] ,'green')."]";
$this->text['primary_key'] = "[".$this->command->paintStri... | php | protected function stylingText()
{
$this->text['first_key'] = "[".$this->command->paintString($this->defaultOptions['first_key'] ,'green')."]";
$this->text['second_key'] = "[".$this->command->paintString($this->defaultOptions['second_key'] ,'green')."]";
$this->text['primary_key'] = "[".$this->command->paintStri... | [
"protected",
"function",
"stylingText",
"(",
")",
"{",
"$",
"this",
"->",
"text",
"[",
"'first_key'",
"]",
"=",
"\"[\"",
".",
"$",
"this",
"->",
"command",
"->",
"paintString",
"(",
"$",
"this",
"->",
"defaultOptions",
"[",
"'first_key'",
"]",
",",
"'gre... | styling text
@return void | [
"styling",
"text"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Relations/HasManyThrough.php#L41-L51 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/Relations/HasManyThrough.php | HasManyThrough.setConnectedRelationOptions | protected function setConnectedRelationOptions()
{
$intermediateModel = $this->defaultOptions['intermediate_model'];
if (! $this->db->isTableExists($intermediateModel->getTable())) {
throw new TableNotExists($intermediateModel->getTable(), get_class($intermediateModel));
}
if (! $this->db->isFieldExists($... | php | protected function setConnectedRelationOptions()
{
$intermediateModel = $this->defaultOptions['intermediate_model'];
if (! $this->db->isTableExists($intermediateModel->getTable())) {
throw new TableNotExists($intermediateModel->getTable(), get_class($intermediateModel));
}
if (! $this->db->isFieldExists($... | [
"protected",
"function",
"setConnectedRelationOptions",
"(",
")",
"{",
"$",
"intermediateModel",
"=",
"$",
"this",
"->",
"defaultOptions",
"[",
"'intermediate_model'",
"]",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"db",
"->",
"isTableExists",
"(",
"$",
"interme... | set connected db relation options
@return void | [
"set",
"connected",
"db",
"relation",
"options"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Relations/HasManyThrough.php#L58-L86 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/Relations/HasManyThrough.php | HasManyThrough.askToUseCustomeOptions | protected function askToUseCustomeOptions()
{
$intermediateModel = $this->defaultOptions['intermediate_model'];
$this->options['first_key'] = $this->command->ask(
"The {$this->text['foreign_text']} of table {$this->text['model_table']} in the table {$this->text['intermediate_model_table']} will be?",
... | php | protected function askToUseCustomeOptions()
{
$intermediateModel = $this->defaultOptions['intermediate_model'];
$this->options['first_key'] = $this->command->ask(
"The {$this->text['foreign_text']} of table {$this->text['model_table']} in the table {$this->text['intermediate_model_table']} will be?",
... | [
"protected",
"function",
"askToUseCustomeOptions",
"(",
")",
"{",
"$",
"intermediateModel",
"=",
"$",
"this",
"->",
"defaultOptions",
"[",
"'intermediate_model'",
"]",
";",
"$",
"this",
"->",
"options",
"[",
"'first_key'",
"]",
"=",
"$",
"this",
"->",
"command... | ask to use custome options
@return void | [
"ask",
"to",
"use",
"custome",
"options"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Relations/HasManyThrough.php#L120-L139 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.