id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
38,300 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.get | public function get($instanceName) {
if (!isset($this->objectInstances[$instanceName]) || $this->objectInstances[$instanceName] == null) {
$this->instantiateComponent($instanceName);
}
return $this->objectInstances[$instanceName];
} | php | public function get($instanceName) {
if (!isset($this->objectInstances[$instanceName]) || $this->objectInstances[$instanceName] == null) {
$this->instantiateComponent($instanceName);
}
return $this->objectInstances[$instanceName];
} | [
"public",
"function",
"get",
"(",
"$",
"instanceName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"objectInstances",
"[",
"$",
"instanceName",
"]",
")",
"||",
"$",
"this",
"->",
"objectInstances",
"[",
"$",
"instanceName",
"]",
"==",
"n... | Returns the instance of the specified object.
@param string $instanceName
@return object | [
"Returns",
"the",
"instance",
"of",
"the",
"specified",
"object",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L255-L260 |
38,301 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.getInstancesList | public function getInstancesList() {
$arr = array();
foreach ($this->declaredInstances as $instanceName=>$classDesc) {
//if (!isset($classDesc["class"])) {var_dump($instanceName);var_dump($classDesc);}
$arr[$instanceName] = isset($classDesc['class'])?$classDesc['class']:null;
}
return $arr;
} | php | public function getInstancesList() {
$arr = array();
foreach ($this->declaredInstances as $instanceName=>$classDesc) {
//if (!isset($classDesc["class"])) {var_dump($instanceName);var_dump($classDesc);}
$arr[$instanceName] = isset($classDesc['class'])?$classDesc['class']:null;
}
return $arr;
} | [
"public",
"function",
"getInstancesList",
"(",
")",
"{",
"$",
"arr",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"declaredInstances",
"as",
"$",
"instanceName",
"=>",
"$",
"classDesc",
")",
"{",
"//if (!isset($classDesc[\"class\"])) {var_dump... | Returns the list of all instances of objects in Mouf.
Objects are not instanciated. Instead, a list containing the name of the instance in the key
and the name of the class in the value is returned.
@return array<string, string> | [
"Returns",
"the",
"list",
"of",
"all",
"instances",
"of",
"objects",
"in",
"Mouf",
".",
"Objects",
"are",
"not",
"instanciated",
".",
"Instead",
"a",
"list",
"containing",
"the",
"name",
"of",
"the",
"instance",
"in",
"the",
"key",
"and",
"the",
"name",
... | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L300-L307 |
38,302 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.declareComponent | public function declareComponent($instanceName, $className, $external = false, $mode = self::DECLARE_ON_EXIST_EXCEPTION, $weak = false) {
if (isset($this->declaredInstances[$instanceName])) {
if ($mode == self::DECLARE_ON_EXIST_EXCEPTION) {
throw new MoufException("Unable to create Mouf instance named '".$instanceName."'. An instance with this name already exists.");
} elseif ($mode == self::DECLARE_ON_EXIST_KEEP_INCOMING_LINKS) {
$this->declaredInstances[$instanceName]["fieldProperties"] = array();
$this->declaredInstances[$instanceName]["setterProperties"] = array();
$this->declaredInstances[$instanceName]["fieldBinds"] = array();
$this->declaredInstances[$instanceName]["setterBinds"] = array();
$this->declaredInstances[$instanceName]["weak"] = $weak;
$this->declaredInstances[$instanceName]["comment"] = "";
} elseif ($mode == self::DECLARE_ON_EXIST_KEEP_ALL) {
// Do nothing
}
}
if (strpos($className, '\\' === 0)) {
$className = substr($className, 1);
}
$this->declaredInstances[$instanceName]["class"] = $className;
$this->declaredInstances[$instanceName]["external"] = $external;
} | php | public function declareComponent($instanceName, $className, $external = false, $mode = self::DECLARE_ON_EXIST_EXCEPTION, $weak = false) {
if (isset($this->declaredInstances[$instanceName])) {
if ($mode == self::DECLARE_ON_EXIST_EXCEPTION) {
throw new MoufException("Unable to create Mouf instance named '".$instanceName."'. An instance with this name already exists.");
} elseif ($mode == self::DECLARE_ON_EXIST_KEEP_INCOMING_LINKS) {
$this->declaredInstances[$instanceName]["fieldProperties"] = array();
$this->declaredInstances[$instanceName]["setterProperties"] = array();
$this->declaredInstances[$instanceName]["fieldBinds"] = array();
$this->declaredInstances[$instanceName]["setterBinds"] = array();
$this->declaredInstances[$instanceName]["weak"] = $weak;
$this->declaredInstances[$instanceName]["comment"] = "";
} elseif ($mode == self::DECLARE_ON_EXIST_KEEP_ALL) {
// Do nothing
}
}
if (strpos($className, '\\' === 0)) {
$className = substr($className, 1);
}
$this->declaredInstances[$instanceName]["class"] = $className;
$this->declaredInstances[$instanceName]["external"] = $external;
} | [
"public",
"function",
"declareComponent",
"(",
"$",
"instanceName",
",",
"$",
"className",
",",
"$",
"external",
"=",
"false",
",",
"$",
"mode",
"=",
"self",
"::",
"DECLARE_ON_EXIST_EXCEPTION",
",",
"$",
"weak",
"=",
"false",
")",
"{",
"if",
"(",
"isset",
... | Declares a new component.
@param string $instanceName
@param string $className
@param boolean $external Whether the component is external or not. Defaults to false.
@param int $mode Depending on the mode, the behaviour will be different if an instance with the same name already exists.
@param bool $weak If the object is weak, it will be destroyed if it is no longer referenced. | [
"Declares",
"a",
"new",
"component",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L330-L352 |
38,303 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.removeComponent | public function removeComponent($instanceName) {
unset($this->instanceDescriptors[$instanceName]);
unset($this->declaredInstances[$instanceName]);
if (isset($this->instanceDescriptors[$instanceName])) {
unset($this->instanceDescriptors[$instanceName]);
}
foreach ($this->declaredInstances as $declaredInstanceName=>$declaredInstance) {
if (isset($declaredInstance["constructor"])) {
foreach ($declaredInstance["constructor"] as $index=>$propWrapper) {
if ($propWrapper['parametertype'] == 'object') {
$properties = $propWrapper['value'];
if (is_array($properties)) {
// If this is an array of properties
$keys_matching = array_keys($properties, $instanceName);
if (!empty($keys_matching)) {
foreach ($keys_matching as $key) {
unset($properties[$key]);
}
$this->setParameterViaConstructor($declaredInstanceName, $index, $properties, 'object');
}
} else {
// If this is a simple property
if ($properties == $instanceName) {
$this->setParameterViaConstructor($declaredInstanceName, $index, null, 'object');
}
}
}
}
}
}
foreach ($this->declaredInstances as $declaredInstanceName=>$declaredInstance) {
if (isset($declaredInstance["fieldBinds"])) {
foreach ($declaredInstance["fieldBinds"] as $paramName=>$properties) {
if (is_array($properties)) {
// If this is an array of properties
$keys_matching = array_keys($properties, $instanceName);
if (!empty($keys_matching)) {
foreach ($keys_matching as $key) {
unset($properties[$key]);
}
$this->bindComponents($declaredInstanceName, $paramName, $properties);
}
} else {
// If this is a simple property
if ($properties == $instanceName) {
$this->bindComponent($declaredInstanceName, $paramName, null);
}
}
}
}
}
foreach ($this->declaredInstances as $declaredInstanceName=>$declaredInstance) {
if (isset($declaredInstance["setterBinds"])) {
foreach ($declaredInstance["setterBinds"] as $setterName=>$properties) {
if (is_array($properties)) {
// If this is an array of properties
$keys_matching = array_keys($properties, $instanceName);
if (!empty($keys_matching)) {
foreach ($keys_matching as $key) {
unset($properties[$key]);
}
$this->bindComponentsViaSetter($declaredInstanceName, $setterName, $properties);
}
} else {
// If this is a simple property
if ($properties == $instanceName) {
$this->bindComponentViaSetter($declaredInstanceName, $setterName, null);
}
}
}
}
}
} | php | public function removeComponent($instanceName) {
unset($this->instanceDescriptors[$instanceName]);
unset($this->declaredInstances[$instanceName]);
if (isset($this->instanceDescriptors[$instanceName])) {
unset($this->instanceDescriptors[$instanceName]);
}
foreach ($this->declaredInstances as $declaredInstanceName=>$declaredInstance) {
if (isset($declaredInstance["constructor"])) {
foreach ($declaredInstance["constructor"] as $index=>$propWrapper) {
if ($propWrapper['parametertype'] == 'object') {
$properties = $propWrapper['value'];
if (is_array($properties)) {
// If this is an array of properties
$keys_matching = array_keys($properties, $instanceName);
if (!empty($keys_matching)) {
foreach ($keys_matching as $key) {
unset($properties[$key]);
}
$this->setParameterViaConstructor($declaredInstanceName, $index, $properties, 'object');
}
} else {
// If this is a simple property
if ($properties == $instanceName) {
$this->setParameterViaConstructor($declaredInstanceName, $index, null, 'object');
}
}
}
}
}
}
foreach ($this->declaredInstances as $declaredInstanceName=>$declaredInstance) {
if (isset($declaredInstance["fieldBinds"])) {
foreach ($declaredInstance["fieldBinds"] as $paramName=>$properties) {
if (is_array($properties)) {
// If this is an array of properties
$keys_matching = array_keys($properties, $instanceName);
if (!empty($keys_matching)) {
foreach ($keys_matching as $key) {
unset($properties[$key]);
}
$this->bindComponents($declaredInstanceName, $paramName, $properties);
}
} else {
// If this is a simple property
if ($properties == $instanceName) {
$this->bindComponent($declaredInstanceName, $paramName, null);
}
}
}
}
}
foreach ($this->declaredInstances as $declaredInstanceName=>$declaredInstance) {
if (isset($declaredInstance["setterBinds"])) {
foreach ($declaredInstance["setterBinds"] as $setterName=>$properties) {
if (is_array($properties)) {
// If this is an array of properties
$keys_matching = array_keys($properties, $instanceName);
if (!empty($keys_matching)) {
foreach ($keys_matching as $key) {
unset($properties[$key]);
}
$this->bindComponentsViaSetter($declaredInstanceName, $setterName, $properties);
}
} else {
// If this is a simple property
if ($properties == $instanceName) {
$this->bindComponentViaSetter($declaredInstanceName, $setterName, null);
}
}
}
}
}
} | [
"public",
"function",
"removeComponent",
"(",
"$",
"instanceName",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"instanceDescriptors",
"[",
"$",
"instanceName",
"]",
")",
";",
"unset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",... | Removes an instance.
Sets to null any property linking to that component.
@param string $instanceName | [
"Removes",
"an",
"instance",
".",
"Sets",
"to",
"null",
"any",
"property",
"linking",
"to",
"that",
"component",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L360-L435 |
38,304 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.getInstanceType | public function getInstanceType($instanceName) {
if (isset($this->declaredInstances[$instanceName]['class'])) {
return $this->declaredInstances[$instanceName]['class'];
} else {
return null;
}
} | php | public function getInstanceType($instanceName) {
if (isset($this->declaredInstances[$instanceName]['class'])) {
return $this->declaredInstances[$instanceName]['class'];
} else {
return null;
}
} | [
"public",
"function",
"getInstanceType",
"(",
"$",
"instanceName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'class'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"declaredInstances... | Return the type of the instance.
@param string $instanceName The instance name
@return string The class name of the instance | [
"Return",
"the",
"type",
"of",
"the",
"instance",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L542-L548 |
38,305 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.setParameter | public function setParameter($instanceName, $paramName, $paramValue, $type = "string", array $metadata = array()) {
if ($type != "string" && $type != "config" && $type != "request" && $type != "session" && $type != "php") {
throw new MoufContainerException("Invalid type. Must be one of: string|config|request|session. Value passed: '".$type."'");
}
$this->declaredInstances[$instanceName]["fieldProperties"][$paramName]["value"] = $paramValue;
$this->declaredInstances[$instanceName]["fieldProperties"][$paramName]["type"] = $type;
$this->declaredInstances[$instanceName]["fieldProperties"][$paramName]["metadata"] = $metadata;
} | php | public function setParameter($instanceName, $paramName, $paramValue, $type = "string", array $metadata = array()) {
if ($type != "string" && $type != "config" && $type != "request" && $type != "session" && $type != "php") {
throw new MoufContainerException("Invalid type. Must be one of: string|config|request|session. Value passed: '".$type."'");
}
$this->declaredInstances[$instanceName]["fieldProperties"][$paramName]["value"] = $paramValue;
$this->declaredInstances[$instanceName]["fieldProperties"][$paramName]["type"] = $type;
$this->declaredInstances[$instanceName]["fieldProperties"][$paramName]["metadata"] = $metadata;
} | [
"public",
"function",
"setParameter",
"(",
"$",
"instanceName",
",",
"$",
"paramName",
",",
"$",
"paramValue",
",",
"$",
"type",
"=",
"\"string\"",
",",
"array",
"$",
"metadata",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"type",
"!=",
"\"string... | Binds a parameter to the instance.
@param string $instanceName
@param string $paramName
@param string $paramValue
@param string $type Can be one of "string|config|request|session|php"
@param array $metadata An array containing metadata | [
"Binds",
"a",
"parameter",
"to",
"the",
"instance",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L766-L774 |
38,306 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.setParameterViaSetter | public function setParameterViaSetter($instanceName, $setterName, $paramValue, $type = "string", array $metadata = array()) {
if ($type != "string" && $type != "config" && $type != "request" && $type != "session" && $type != "php") {
throw new MoufContainerException("Invalid type. Must be one of: string|config|request|session");
}
$this->declaredInstances[$instanceName]["setterProperties"][$setterName]["value"] = $paramValue;
$this->declaredInstances[$instanceName]["setterProperties"][$setterName]["type"] = $type;
$this->declaredInstances[$instanceName]["setterProperties"][$setterName]["metadata"] = $metadata;
} | php | public function setParameterViaSetter($instanceName, $setterName, $paramValue, $type = "string", array $metadata = array()) {
if ($type != "string" && $type != "config" && $type != "request" && $type != "session" && $type != "php") {
throw new MoufContainerException("Invalid type. Must be one of: string|config|request|session");
}
$this->declaredInstances[$instanceName]["setterProperties"][$setterName]["value"] = $paramValue;
$this->declaredInstances[$instanceName]["setterProperties"][$setterName]["type"] = $type;
$this->declaredInstances[$instanceName]["setterProperties"][$setterName]["metadata"] = $metadata;
} | [
"public",
"function",
"setParameterViaSetter",
"(",
"$",
"instanceName",
",",
"$",
"setterName",
",",
"$",
"paramValue",
",",
"$",
"type",
"=",
"\"string\"",
",",
"array",
"$",
"metadata",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"type",
"!=",
... | Binds a parameter to the instance using a setter.
@param string $instanceName
@param string $setterName
@param string $paramValue
@param string $type Can be one of "string|config|request|session|php"
@param array $metadata An array containing metadata | [
"Binds",
"a",
"parameter",
"to",
"the",
"instance",
"using",
"a",
"setter",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L785-L793 |
38,307 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.setParameterViaConstructor | public function setParameterViaConstructor($instanceName, $index, $paramValue, $parameterType, $type = "string", array $metadata = array()) {
if ($type != "string" && $type != "config" && $type != "request" && $type != "session" && $type != "php") {
throw new MoufContainerException("Invalid type. Must be one of: string|config|request|session");
}
$this->declaredInstances[$instanceName]['constructor'][$index]["value"] = $paramValue;
$this->declaredInstances[$instanceName]['constructor'][$index]["parametertype"] = $parameterType;
$this->declaredInstances[$instanceName]['constructor'][$index]["type"] = $type;
$this->declaredInstances[$instanceName]['constructor'][$index]["metadata"] = $metadata;
// Now, let's make sure that all indexes BEFORE ours are set, and let's order everything by key.
for ($i=0; $i<$index; $i++) {
if (!isset($this->declaredInstances[$instanceName]['constructor'][$i])) {
// If the parameter before does not exist, let's set it to null.
$this->declaredInstances[$instanceName]['constructor'][$i]["value"] = null;
$this->declaredInstances[$instanceName]['constructor'][$i]["parametertype"] = "primitive";
$this->declaredInstances[$instanceName]['constructor'][$i]["type"] = "string";
$this->declaredInstances[$instanceName]['constructor'][$i]["metadata"] = array();
}
}
ksort($this->declaredInstances[$instanceName]['constructor']);
} | php | public function setParameterViaConstructor($instanceName, $index, $paramValue, $parameterType, $type = "string", array $metadata = array()) {
if ($type != "string" && $type != "config" && $type != "request" && $type != "session" && $type != "php") {
throw new MoufContainerException("Invalid type. Must be one of: string|config|request|session");
}
$this->declaredInstances[$instanceName]['constructor'][$index]["value"] = $paramValue;
$this->declaredInstances[$instanceName]['constructor'][$index]["parametertype"] = $parameterType;
$this->declaredInstances[$instanceName]['constructor'][$index]["type"] = $type;
$this->declaredInstances[$instanceName]['constructor'][$index]["metadata"] = $metadata;
// Now, let's make sure that all indexes BEFORE ours are set, and let's order everything by key.
for ($i=0; $i<$index; $i++) {
if (!isset($this->declaredInstances[$instanceName]['constructor'][$i])) {
// If the parameter before does not exist, let's set it to null.
$this->declaredInstances[$instanceName]['constructor'][$i]["value"] = null;
$this->declaredInstances[$instanceName]['constructor'][$i]["parametertype"] = "primitive";
$this->declaredInstances[$instanceName]['constructor'][$i]["type"] = "string";
$this->declaredInstances[$instanceName]['constructor'][$i]["metadata"] = array();
}
}
ksort($this->declaredInstances[$instanceName]['constructor']);
} | [
"public",
"function",
"setParameterViaConstructor",
"(",
"$",
"instanceName",
",",
"$",
"index",
",",
"$",
"paramValue",
",",
"$",
"parameterType",
",",
"$",
"type",
"=",
"\"string\"",
",",
"array",
"$",
"metadata",
"=",
"array",
"(",
")",
")",
"{",
"if",
... | Binds a parameter to the instance using a constructor parameter.
@param string $instanceName
@param string $index
@param string $paramValue
@param string $parameterType Can be one of "primitive" or "object".
@param string $type Can be one of "string|config|request|session|php"
@param array $metadata An array containing metadata | [
"Binds",
"a",
"parameter",
"to",
"the",
"instance",
"using",
"a",
"constructor",
"parameter",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L805-L826 |
38,308 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.isParameterSet | public function isParameterSet($instanceName, $paramName) {
return isset($this->declaredInstances[$instanceName]['fieldProperties'][$paramName]) || isset($this->declaredInstances[$instanceName]['fieldBinds'][$paramName]);
} | php | public function isParameterSet($instanceName, $paramName) {
return isset($this->declaredInstances[$instanceName]['fieldProperties'][$paramName]) || isset($this->declaredInstances[$instanceName]['fieldBinds'][$paramName]);
} | [
"public",
"function",
"isParameterSet",
"(",
"$",
"instanceName",
",",
"$",
"paramName",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'fieldProperties'",
"]",
"[",
"$",
"paramName",
"]",
")",
... | Returns true if the value of the given parameter is set.
False otherwise.
@param string $instanceName
@param string $paramName
@return boolean | [
"Returns",
"true",
"if",
"the",
"value",
"of",
"the",
"given",
"parameter",
"is",
"set",
".",
"False",
"otherwise",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L863-L865 |
38,309 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.unsetParameter | public function unsetParameter($instanceName, $paramName) {
unset($this->declaredInstances[$instanceName]['fieldProperties'][$paramName]);
unset($this->declaredInstances[$instanceName]['fieldBinds'][$paramName]);
} | php | public function unsetParameter($instanceName, $paramName) {
unset($this->declaredInstances[$instanceName]['fieldProperties'][$paramName]);
unset($this->declaredInstances[$instanceName]['fieldBinds'][$paramName]);
} | [
"public",
"function",
"unsetParameter",
"(",
"$",
"instanceName",
",",
"$",
"paramName",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'fieldProperties'",
"]",
"[",
"$",
"paramName",
"]",
")",
";",
"un... | Completely unset this parameter from the DI container.
@param string $instanceName
@param string $paramName | [
"Completely",
"unset",
"this",
"parameter",
"from",
"the",
"DI",
"container",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L873-L876 |
38,310 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.getParameterForSetter | public function getParameterForSetter($instanceName, $setterName) {
// todo: improve this
if (isset($this->declaredInstances[$instanceName]['setterProperties'][$setterName]['value'])) {
return $this->declaredInstances[$instanceName]['setterProperties'][$setterName]['value'];
} else {
return null;
}
} | php | public function getParameterForSetter($instanceName, $setterName) {
// todo: improve this
if (isset($this->declaredInstances[$instanceName]['setterProperties'][$setterName]['value'])) {
return $this->declaredInstances[$instanceName]['setterProperties'][$setterName]['value'];
} else {
return null;
}
} | [
"public",
"function",
"getParameterForSetter",
"(",
"$",
"instanceName",
",",
"$",
"setterName",
")",
"{",
"// todo: improve this\r",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'setterProperties'",
"]",
... | Returns the value for the given parameter that has been set using a setter.
@param string $instanceName
@param string $setterName
@return mixed | [
"Returns",
"the",
"value",
"for",
"the",
"given",
"parameter",
"that",
"has",
"been",
"set",
"using",
"a",
"setter",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L885-L892 |
38,311 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.isParameterSetForSetter | public function isParameterSetForSetter($instanceName, $setterName) {
return isset($this->declaredInstances[$instanceName]['setterProperties'][$setterName]) || isset($this->declaredInstances[$instanceName]['setterBinds'][$setterName]);
} | php | public function isParameterSetForSetter($instanceName, $setterName) {
return isset($this->declaredInstances[$instanceName]['setterProperties'][$setterName]) || isset($this->declaredInstances[$instanceName]['setterBinds'][$setterName]);
} | [
"public",
"function",
"isParameterSetForSetter",
"(",
"$",
"instanceName",
",",
"$",
"setterName",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'setterProperties'",
"]",
"[",
"$",
"setterName",
... | Returns true if the value of the given setter parameter is set.
False otherwise.
@param string $instanceName
@param string $setterName
@return boolean | [
"Returns",
"true",
"if",
"the",
"value",
"of",
"the",
"given",
"setter",
"parameter",
"is",
"set",
".",
"False",
"otherwise",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L902-L904 |
38,312 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.unsetParameterForSetter | public function unsetParameterForSetter($instanceName, $setterName) {
unset($this->declaredInstances[$instanceName]['setterProperties'][$setterName]);
unset($this->declaredInstances[$instanceName]['setterBinds'][$setterName]);
} | php | public function unsetParameterForSetter($instanceName, $setterName) {
unset($this->declaredInstances[$instanceName]['setterProperties'][$setterName]);
unset($this->declaredInstances[$instanceName]['setterBinds'][$setterName]);
} | [
"public",
"function",
"unsetParameterForSetter",
"(",
"$",
"instanceName",
",",
"$",
"setterName",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'setterProperties'",
"]",
"[",
"$",
"setterName",
"]",
")",
... | Completely unset this setter parameter from the DI container.
@param string $instanceName
@param string $setterName | [
"Completely",
"unset",
"this",
"setter",
"parameter",
"from",
"the",
"DI",
"container",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L912-L915 |
38,313 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.getParameterForConstructor | public function getParameterForConstructor($instanceName, $index) {
if (isset($this->declaredInstances[$instanceName]['constructor'][$index]['value'])) {
return $this->declaredInstances[$instanceName]['constructor'][$index]['value'];
} else {
return null;
}
} | php | public function getParameterForConstructor($instanceName, $index) {
if (isset($this->declaredInstances[$instanceName]['constructor'][$index]['value'])) {
return $this->declaredInstances[$instanceName]['constructor'][$index]['value'];
} else {
return null;
}
} | [
"public",
"function",
"getParameterForConstructor",
"(",
"$",
"instanceName",
",",
"$",
"index",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'constructor'",
"]",
"[",
"$",
"index",
"]",
"[... | Returns the value for the given parameter that has been set using a constructor.
@param string $instanceName
@param int $index
@return mixed | [
"Returns",
"the",
"value",
"for",
"the",
"given",
"parameter",
"that",
"has",
"been",
"set",
"using",
"a",
"constructor",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L924-L930 |
38,314 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.isConstructorParameterObjectOrPrimitive | public function isConstructorParameterObjectOrPrimitive($instanceName, $index) {
if (isset($this->declaredInstances[$instanceName]['constructor'][$index]['parametertype'])) {
return $this->declaredInstances[$instanceName]['constructor'][$index]['parametertype'];
} else {
return null;
}
} | php | public function isConstructorParameterObjectOrPrimitive($instanceName, $index) {
if (isset($this->declaredInstances[$instanceName]['constructor'][$index]['parametertype'])) {
return $this->declaredInstances[$instanceName]['constructor'][$index]['parametertype'];
} else {
return null;
}
} | [
"public",
"function",
"isConstructorParameterObjectOrPrimitive",
"(",
"$",
"instanceName",
",",
"$",
"index",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'constructor'",
"]",
"[",
"$",
"index"... | The type of the parameter for a constructor parameter. Can be one of "primitive" or "object".
@param string $instanceName
@param int $index
@return string | [
"The",
"type",
"of",
"the",
"parameter",
"for",
"a",
"constructor",
"parameter",
".",
"Can",
"be",
"one",
"of",
"primitive",
"or",
"object",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L938-L944 |
38,315 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.unsetParameterForConstructor | public function unsetParameterForConstructor($instanceName, $index) {
if (isset($this->declaredInstances[$instanceName]['constructor'])) {
$max = count($this->declaredInstances[$instanceName]['constructor']);
if($index != $max - 1) {
// It is forbidden to unset a parameter that is not the last.
// Let set null
$this->setParameterViaConstructor($instanceName, $index, null, 'primitive');
}
else {
unset($this->declaredInstances[$instanceName]['constructor'][$index]);
}
}
} | php | public function unsetParameterForConstructor($instanceName, $index) {
if (isset($this->declaredInstances[$instanceName]['constructor'])) {
$max = count($this->declaredInstances[$instanceName]['constructor']);
if($index != $max - 1) {
// It is forbidden to unset a parameter that is not the last.
// Let set null
$this->setParameterViaConstructor($instanceName, $index, null, 'primitive');
}
else {
unset($this->declaredInstances[$instanceName]['constructor'][$index]);
}
}
} | [
"public",
"function",
"unsetParameterForConstructor",
"(",
"$",
"instanceName",
",",
"$",
"index",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'constructor'",
"]",
")",
")",
"{",
"$",
"max... | Completely unset this constructor parameter from the DI container.
@param string $instanceName
@param int $index | [
"Completely",
"unset",
"this",
"constructor",
"parameter",
"from",
"the",
"DI",
"container",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L964-L976 |
38,316 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.getParameterMetadata | public function getParameterMetadata($instanceName, $paramName) {
if (isset($this->declaredInstances[$instanceName]['fieldProperties'][$paramName]['metadata'])) {
return $this->declaredInstances[$instanceName]['fieldProperties'][$paramName]['metadata'];
} else {
return array();
}
} | php | public function getParameterMetadata($instanceName, $paramName) {
if (isset($this->declaredInstances[$instanceName]['fieldProperties'][$paramName]['metadata'])) {
return $this->declaredInstances[$instanceName]['fieldProperties'][$paramName]['metadata'];
} else {
return array();
}
} | [
"public",
"function",
"getParameterMetadata",
"(",
"$",
"instanceName",
",",
"$",
"paramName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'fieldProperties'",
"]",
"[",
"$",
"paramName",
"]"... | Returns the metadata for the given parameter.
Metadata is an array of key=>value, containing additional info.
For instance, it could contain information on the way to represent a field in the UI, etc...
@param string $instanceName
@param string $paramName
@return string | [
"Returns",
"the",
"metadata",
"for",
"the",
"given",
"parameter",
".",
"Metadata",
"is",
"an",
"array",
"of",
"key",
"=",
">",
"value",
"containing",
"additional",
"info",
".",
"For",
"instance",
"it",
"could",
"contain",
"information",
"on",
"the",
"way",
... | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1066-L1072 |
38,317 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.getParameterMetadataForSetter | public function getParameterMetadataForSetter($instanceName, $setterName) {
if (isset($this->declaredInstances[$instanceName]['setterProperties'][$setterName]['metadata'])) {
return $this->declaredInstances[$instanceName]['setterProperties'][$setterName]['metadata'];
} else {
return array();
}
} | php | public function getParameterMetadataForSetter($instanceName, $setterName) {
if (isset($this->declaredInstances[$instanceName]['setterProperties'][$setterName]['metadata'])) {
return $this->declaredInstances[$instanceName]['setterProperties'][$setterName]['metadata'];
} else {
return array();
}
} | [
"public",
"function",
"getParameterMetadataForSetter",
"(",
"$",
"instanceName",
",",
"$",
"setterName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'setterProperties'",
"]",
"[",
"$",
"setter... | Returns the metadata for the given parameter that has been set using a setter.
Metadata is an array of key=>value, containing additional info.
For instance, it could contain information on the way to represent a field in the UI, etc...
@param string $instanceName
@param string $setterName
@return string | [
"Returns",
"the",
"metadata",
"for",
"the",
"given",
"parameter",
"that",
"has",
"been",
"set",
"using",
"a",
"setter",
".",
"Metadata",
"is",
"an",
"array",
"of",
"key",
"=",
">",
"value",
"containing",
"additional",
"info",
".",
"For",
"instance",
"it",
... | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1083-L1089 |
38,318 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.getParameterMetadataForConstructor | public function getParameterMetadataForConstructor($instanceName, $index) {
if (isset($this->declaredInstances[$instanceName]['constructor'][$index]['metadata'])) {
return $this->declaredInstances[$instanceName]['constructor'][$index]['metadata'];
} else {
return array();
}
} | php | public function getParameterMetadataForConstructor($instanceName, $index) {
if (isset($this->declaredInstances[$instanceName]['constructor'][$index]['metadata'])) {
return $this->declaredInstances[$instanceName]['constructor'][$index]['metadata'];
} else {
return array();
}
} | [
"public",
"function",
"getParameterMetadataForConstructor",
"(",
"$",
"instanceName",
",",
"$",
"index",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'constructor'",
"]",
"[",
"$",
"index",
"... | Returns the metadata for the given parameter that has been set using a constructor parameter.
Metadata is an array of key=>value, containing additional info.
For instance, it could contain information on the way to represent a field in the UI, etc...
@param string $instanceName
@param int $index
@return string | [
"Returns",
"the",
"metadata",
"for",
"the",
"given",
"parameter",
"that",
"has",
"been",
"set",
"using",
"a",
"constructor",
"parameter",
".",
"Metadata",
"is",
"an",
"array",
"of",
"key",
"=",
">",
"value",
"containing",
"additional",
"info",
".",
"For",
... | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1100-L1106 |
38,319 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.bindComponent | public function bindComponent($instanceName, $paramName, $paramValue) {
if ($paramValue == null) {
unset($this->declaredInstances[$instanceName]["fieldBinds"][$paramName]);
} else {
$this->declaredInstances[$instanceName]["fieldBinds"][$paramName] = $paramValue;
}
} | php | public function bindComponent($instanceName, $paramName, $paramValue) {
if ($paramValue == null) {
unset($this->declaredInstances[$instanceName]["fieldBinds"][$paramName]);
} else {
$this->declaredInstances[$instanceName]["fieldBinds"][$paramName] = $paramValue;
}
} | [
"public",
"function",
"bindComponent",
"(",
"$",
"instanceName",
",",
"$",
"paramName",
",",
"$",
"paramValue",
")",
"{",
"if",
"(",
"$",
"paramValue",
"==",
"null",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
... | Binds another instance to the instance.
@param string $instanceName
@param string $paramName
@param string $paramValue the name of the instance to bind to. | [
"Binds",
"another",
"instance",
"to",
"the",
"instance",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1144-L1150 |
38,320 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.bindComponentViaSetter | public function bindComponentViaSetter($instanceName, $setterName, $paramValue) {
if ($paramValue == null) {
unset($this->declaredInstances[$instanceName]["setterBinds"][$setterName]);
} else {
$this->declaredInstances[$instanceName]["setterBinds"][$setterName] = $paramValue;
}
} | php | public function bindComponentViaSetter($instanceName, $setterName, $paramValue) {
if ($paramValue == null) {
unset($this->declaredInstances[$instanceName]["setterBinds"][$setterName]);
} else {
$this->declaredInstances[$instanceName]["setterBinds"][$setterName] = $paramValue;
}
} | [
"public",
"function",
"bindComponentViaSetter",
"(",
"$",
"instanceName",
",",
"$",
"setterName",
",",
"$",
"paramValue",
")",
"{",
"if",
"(",
"$",
"paramValue",
"==",
"null",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"insta... | Binds another instance to the instance via a setter.
@param string $instanceName
@param string $setterName
@param string $paramValue the name of the instance to bind to. | [
"Binds",
"another",
"instance",
"to",
"the",
"instance",
"via",
"a",
"setter",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1159-L1165 |
38,321 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.bindComponents | public function bindComponents($instanceName, $paramName, $paramValue) {
if ($paramValue == null) {
unset($this->declaredInstances[$instanceName]["fieldBinds"][$paramName]);
} else {
$this->declaredInstances[$instanceName]["fieldBinds"][$paramName] = $paramValue;
}
} | php | public function bindComponents($instanceName, $paramName, $paramValue) {
if ($paramValue == null) {
unset($this->declaredInstances[$instanceName]["fieldBinds"][$paramName]);
} else {
$this->declaredInstances[$instanceName]["fieldBinds"][$paramName] = $paramValue;
}
} | [
"public",
"function",
"bindComponents",
"(",
"$",
"instanceName",
",",
"$",
"paramName",
",",
"$",
"paramValue",
")",
"{",
"if",
"(",
"$",
"paramValue",
"==",
"null",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",... | Binds an array of instance to the instance.
@param string $instanceName
@param string $paramName
@param array $paramValue an array of names of instance to bind to. | [
"Binds",
"an",
"array",
"of",
"instance",
"to",
"the",
"instance",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1174-L1180 |
38,322 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.bindComponentsViaSetter | public function bindComponentsViaSetter($instanceName, $setterName, $paramValue) {
if ($paramValue == null) {
unset($this->declaredInstances[$instanceName]["setterBinds"][$setterName]);
} else {
$this->declaredInstances[$instanceName]["setterBinds"][$setterName] = $paramValue;
}
} | php | public function bindComponentsViaSetter($instanceName, $setterName, $paramValue) {
if ($paramValue == null) {
unset($this->declaredInstances[$instanceName]["setterBinds"][$setterName]);
} else {
$this->declaredInstances[$instanceName]["setterBinds"][$setterName] = $paramValue;
}
} | [
"public",
"function",
"bindComponentsViaSetter",
"(",
"$",
"instanceName",
",",
"$",
"setterName",
",",
"$",
"paramValue",
")",
"{",
"if",
"(",
"$",
"paramValue",
"==",
"null",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"inst... | Binds an array of instance to the instance via a setter.
@param string $instanceName
@param string $setterName
@param array $paramValue an array of names of instance to bind to. | [
"Binds",
"an",
"array",
"of",
"instance",
"to",
"the",
"instance",
"via",
"a",
"setter",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1189-L1195 |
38,323 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.generateGetterString | private function generateGetterString($instanceName) {
$modInstance = str_replace(" ", "", $instanceName);
$modInstance = str_replace("\n", "", $modInstance);
$modInstance = str_replace("-", "", $modInstance);
$modInstance = str_replace(".", "_", $modInstance);
// Let's remove anything that is not an authorized character:
$modInstance = preg_replace("/[^A-Za-z0-9_]/", "", $modInstance);
return "get".strtoupper(substr($modInstance,0,1)).substr($modInstance,1);
} | php | private function generateGetterString($instanceName) {
$modInstance = str_replace(" ", "", $instanceName);
$modInstance = str_replace("\n", "", $modInstance);
$modInstance = str_replace("-", "", $modInstance);
$modInstance = str_replace(".", "_", $modInstance);
// Let's remove anything that is not an authorized character:
$modInstance = preg_replace("/[^A-Za-z0-9_]/", "", $modInstance);
return "get".strtoupper(substr($modInstance,0,1)).substr($modInstance,1);
} | [
"private",
"function",
"generateGetterString",
"(",
"$",
"instanceName",
")",
"{",
"$",
"modInstance",
"=",
"str_replace",
"(",
"\" \"",
",",
"\"\"",
",",
"$",
"instanceName",
")",
";",
"$",
"modInstance",
"=",
"str_replace",
"(",
"\"\\n\"",
",",
"\"\"",
","... | Generate the string for the getter by uppercasing the first character and prepending "get".
@param string $instanceName
@return string | [
"Generate",
"the",
"string",
"for",
"the",
"getter",
"by",
"uppercasing",
"the",
"first",
"character",
"and",
"prepending",
"get",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1420-L1430 |
38,324 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.getBoundComponents | public function getBoundComponents($instanceName) {
// FIXME: not accounting for components bound in constructor
// it is likely this method is not used anymore
// TODO: check usage and remove.
$binds = array();
if (isset($this->declaredInstances[$instanceName]) && isset($this->declaredInstances[$instanceName]['fieldBinds'])) {
$binds = $this->declaredInstances[$instanceName]['fieldBinds'];
}
if (isset($this->declaredInstances[$instanceName]) && isset($this->declaredInstances[$instanceName]['setterBinds'])) {
foreach ($this->declaredInstances[$instanceName]['setterBinds'] as $setter=>$bind) {
$binds[MoufPropertyDescriptor::getPropertyNameFromSetterName($setter)] = $bind;
}
}
return $binds;
} | php | public function getBoundComponents($instanceName) {
// FIXME: not accounting for components bound in constructor
// it is likely this method is not used anymore
// TODO: check usage and remove.
$binds = array();
if (isset($this->declaredInstances[$instanceName]) && isset($this->declaredInstances[$instanceName]['fieldBinds'])) {
$binds = $this->declaredInstances[$instanceName]['fieldBinds'];
}
if (isset($this->declaredInstances[$instanceName]) && isset($this->declaredInstances[$instanceName]['setterBinds'])) {
foreach ($this->declaredInstances[$instanceName]['setterBinds'] as $setter=>$bind) {
$binds[MoufPropertyDescriptor::getPropertyNameFromSetterName($setter)] = $bind;
}
}
return $binds;
} | [
"public",
"function",
"getBoundComponents",
"(",
"$",
"instanceName",
")",
"{",
"// FIXME: not accounting for components bound in constructor\r",
"// it is likely this method is not used anymore\r",
"// TODO: check usage and remove.\r",
"$",
"binds",
"=",
"array",
"(",
")",
";",
... | Returns the list of all components bound to that component.
@param string $instanceName
@return array<string, comp(s)> where comp(s) is a string or an array<string> if there are many components for that property. The key of the array is the name of the property. | [
"Returns",
"the",
"list",
"of",
"all",
"components",
"bound",
"to",
"that",
"component",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1507-L1521 |
38,325 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.getOwnerComponents | public function getOwnerComponents($instanceName) {
$instancesList = array();
foreach ($this->declaredInstances as $scannedInstance=>$instanceDesc) {
if (isset($instanceDesc['fieldBinds'])) {
foreach ($instanceDesc['fieldBinds'] as $declaredBindProperty) {
if (is_array($declaredBindProperty)) {
if (array_search($instanceName, $declaredBindProperty) !== false) {
$instancesList[$scannedInstance] = $scannedInstance;
break;
}
} elseif ($declaredBindProperty == $instanceName) {
$instancesList[$scannedInstance] = $scannedInstance;
}
}
}
}
foreach ($this->declaredInstances as $scannedInstance=>$instanceDesc) {
if (isset($instanceDesc['setterBinds'])) {
foreach ($instanceDesc['setterBinds'] as $declaredBindProperty) {
if (is_array($declaredBindProperty)) {
if (array_search($instanceName, $declaredBindProperty) !== false) {
$instancesList[$scannedInstance] = $scannedInstance;
break;
}
} elseif ($declaredBindProperty == $instanceName) {
$instancesList[$scannedInstance] = $scannedInstance;
}
}
}
}
foreach ($this->declaredInstances as $scannedInstance=>$instanceDesc) {
if (isset($instanceDesc['constructor'])) {
foreach ($instanceDesc['constructor'] as $declaredConstructorProperty) {
if ($declaredConstructorProperty['parametertype']=='object') {
$value = $declaredConstructorProperty['value'];
if (is_array($value)) {
if (array_search($instanceName, $value) !== false) {
$instancesList[$scannedInstance] = $scannedInstance;
break;
}
} elseif ($value == $instanceName) {
$instancesList[$scannedInstance] = $scannedInstance;
}
}
}
}
}
return $instancesList;
} | php | public function getOwnerComponents($instanceName) {
$instancesList = array();
foreach ($this->declaredInstances as $scannedInstance=>$instanceDesc) {
if (isset($instanceDesc['fieldBinds'])) {
foreach ($instanceDesc['fieldBinds'] as $declaredBindProperty) {
if (is_array($declaredBindProperty)) {
if (array_search($instanceName, $declaredBindProperty) !== false) {
$instancesList[$scannedInstance] = $scannedInstance;
break;
}
} elseif ($declaredBindProperty == $instanceName) {
$instancesList[$scannedInstance] = $scannedInstance;
}
}
}
}
foreach ($this->declaredInstances as $scannedInstance=>$instanceDesc) {
if (isset($instanceDesc['setterBinds'])) {
foreach ($instanceDesc['setterBinds'] as $declaredBindProperty) {
if (is_array($declaredBindProperty)) {
if (array_search($instanceName, $declaredBindProperty) !== false) {
$instancesList[$scannedInstance] = $scannedInstance;
break;
}
} elseif ($declaredBindProperty == $instanceName) {
$instancesList[$scannedInstance] = $scannedInstance;
}
}
}
}
foreach ($this->declaredInstances as $scannedInstance=>$instanceDesc) {
if (isset($instanceDesc['constructor'])) {
foreach ($instanceDesc['constructor'] as $declaredConstructorProperty) {
if ($declaredConstructorProperty['parametertype']=='object') {
$value = $declaredConstructorProperty['value'];
if (is_array($value)) {
if (array_search($instanceName, $value) !== false) {
$instancesList[$scannedInstance] = $scannedInstance;
break;
}
} elseif ($value == $instanceName) {
$instancesList[$scannedInstance] = $scannedInstance;
}
}
}
}
}
return $instancesList;
} | [
"public",
"function",
"getOwnerComponents",
"(",
"$",
"instanceName",
")",
"{",
"$",
"instancesList",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"declaredInstances",
"as",
"$",
"scannedInstance",
"=>",
"$",
"instanceDesc",
")",
"{",
"if"... | Returns the list of instances that are pointing to this instance through one of their properties.
@param string $instanceName
@return array<string, string> The instances pointing to the passed instance are returned in key and in the value | [
"Returns",
"the",
"list",
"of",
"instances",
"that",
"are",
"pointing",
"to",
"this",
"instance",
"through",
"one",
"of",
"their",
"properties",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1529-L1582 |
38,326 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.purgeUnreachableWeakInstances | public function purgeUnreachableWeakInstances() {
foreach ($this->declaredInstances as $key=>$instance) {
if (!isset($instance['weak']) || $instance['weak'] == false) {
$this->walkForGarbageCollection($key);
}
}
// At this point any instance with the "noGarbageCollect" attribute should be kept. Others should be eliminated.
$keptInstances = array();
foreach ($this->declaredInstances as $key=>$instance) {
if (isset($instance['noGarbageCollect']) && $instance['noGarbageCollect'] == true) {
// Let's clear the flag
unset($this->declaredInstances[$key]['noGarbageCollect']);
} else {
// Let's delete the weak instance
unset($this->declaredInstances[$key]);
}
}
} | php | public function purgeUnreachableWeakInstances() {
foreach ($this->declaredInstances as $key=>$instance) {
if (!isset($instance['weak']) || $instance['weak'] == false) {
$this->walkForGarbageCollection($key);
}
}
// At this point any instance with the "noGarbageCollect" attribute should be kept. Others should be eliminated.
$keptInstances = array();
foreach ($this->declaredInstances as $key=>$instance) {
if (isset($instance['noGarbageCollect']) && $instance['noGarbageCollect'] == true) {
// Let's clear the flag
unset($this->declaredInstances[$key]['noGarbageCollect']);
} else {
// Let's delete the weak instance
unset($this->declaredInstances[$key]);
}
}
} | [
"public",
"function",
"purgeUnreachableWeakInstances",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"declaredInstances",
"as",
"$",
"key",
"=>",
"$",
"instance",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"instance",
"[",
"'weak'",
"]",
")",
"||",... | This function will delete any weak instance that would not be referred anymore.
This is used to garbage-collect any unused weak instances.
This is public only for test purposes | [
"This",
"function",
"will",
"delete",
"any",
"weak",
"instance",
"that",
"would",
"not",
"be",
"referred",
"anymore",
".",
"This",
"is",
"used",
"to",
"garbage",
"-",
"collect",
"any",
"unused",
"weak",
"instances",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1739-L1759 |
38,327 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.walkForGarbageCollection | public function walkForGarbageCollection($instanceName) {
// In case the instance does not exist (this could happen after a failed merge or a manual edit of MoufComponents.php...)
if (!isset($this->declaredInstances[$instanceName])) {
return;
}
$instance = &$this->declaredInstances[$instanceName];
if (isset($instance['noGarbageCollect']) && $instance['noGarbageCollect'] == true) {
// No need to go through already visited nodes.
return;
}
$instance['noGarbageCollect'] = true;
$declaredInstances = &$this->declaredInstances;
$moufManager = $this;
if (isset($instance['constructor'])) {
foreach ($instance['constructor'] as $argument) {
if ($argument["parametertype"] == "object") {
$value = $argument["value"];
if(is_array($value)) {
array_walk_recursive($value, function($singleValue) use (&$declaredInstances, $moufManager) {
if ($singleValue != null) {
$moufManager->walkForGarbageCollection($singleValue);
}
});
/*foreach ($value as $singleValue) {
if ($singleValue != null) {
$this->walkForGarbageCollection($this->declaredInstances[$singleValue]);
}
}*/
}
else {
if ($value != null) {
$this->walkForGarbageCollection($value);
}
}
}
}
}
if (isset($instance['fieldBinds'])) {
foreach ($instance['fieldBinds'] as $prop) {
if(is_array($prop)) {
array_walk_recursive($prop, function($singleProp) use (&$declaredInstances, $moufManager) {
if ($singleProp != null) {
$moufManager->walkForGarbageCollection($singleProp);
}
});
/*foreach ($prop as $singleProp) {
if ($singleProp != null) {
$this->walkForGarbageCollection($this->declaredInstances[$singleProp]);
}
}*/
}
else {
$this->walkForGarbageCollection($prop);
}
}
}
if (isset($instance['setterBinds'])) {
foreach ($instance['setterBinds'] as $prop) {
if(is_array($prop)) {
array_walk_recursive($prop, function($singleProp) use (&$declaredInstances, $moufManager) {
if ($singleProp != null) {
$moufManager->walkForGarbageCollection($singleProp);
}
});
/*foreach ($prop as $singleProp) {
if ($singleProp != null) {
$this->walkForGarbageCollection($this->declaredInstances[$singleProp]);
}
}*/
}
else {
$this->walkForGarbageCollection($prop);
}
}
}
} | php | public function walkForGarbageCollection($instanceName) {
// In case the instance does not exist (this could happen after a failed merge or a manual edit of MoufComponents.php...)
if (!isset($this->declaredInstances[$instanceName])) {
return;
}
$instance = &$this->declaredInstances[$instanceName];
if (isset($instance['noGarbageCollect']) && $instance['noGarbageCollect'] == true) {
// No need to go through already visited nodes.
return;
}
$instance['noGarbageCollect'] = true;
$declaredInstances = &$this->declaredInstances;
$moufManager = $this;
if (isset($instance['constructor'])) {
foreach ($instance['constructor'] as $argument) {
if ($argument["parametertype"] == "object") {
$value = $argument["value"];
if(is_array($value)) {
array_walk_recursive($value, function($singleValue) use (&$declaredInstances, $moufManager) {
if ($singleValue != null) {
$moufManager->walkForGarbageCollection($singleValue);
}
});
/*foreach ($value as $singleValue) {
if ($singleValue != null) {
$this->walkForGarbageCollection($this->declaredInstances[$singleValue]);
}
}*/
}
else {
if ($value != null) {
$this->walkForGarbageCollection($value);
}
}
}
}
}
if (isset($instance['fieldBinds'])) {
foreach ($instance['fieldBinds'] as $prop) {
if(is_array($prop)) {
array_walk_recursive($prop, function($singleProp) use (&$declaredInstances, $moufManager) {
if ($singleProp != null) {
$moufManager->walkForGarbageCollection($singleProp);
}
});
/*foreach ($prop as $singleProp) {
if ($singleProp != null) {
$this->walkForGarbageCollection($this->declaredInstances[$singleProp]);
}
}*/
}
else {
$this->walkForGarbageCollection($prop);
}
}
}
if (isset($instance['setterBinds'])) {
foreach ($instance['setterBinds'] as $prop) {
if(is_array($prop)) {
array_walk_recursive($prop, function($singleProp) use (&$declaredInstances, $moufManager) {
if ($singleProp != null) {
$moufManager->walkForGarbageCollection($singleProp);
}
});
/*foreach ($prop as $singleProp) {
if ($singleProp != null) {
$this->walkForGarbageCollection($this->declaredInstances[$singleProp]);
}
}*/
}
else {
$this->walkForGarbageCollection($prop);
}
}
}
} | [
"public",
"function",
"walkForGarbageCollection",
"(",
"$",
"instanceName",
")",
"{",
"// In case the instance does not exist (this could happen after a failed merge or a manual edit of MoufComponents.php...)\r",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",... | Recursive function that mark this instance as NOT garbage collectable and go through referred nodes.
@param string $instanceName | [
"Recursive",
"function",
"that",
"mark",
"this",
"instance",
"as",
"NOT",
"garbage",
"collectable",
"and",
"go",
"through",
"referred",
"nodes",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1766-L1846 |
38,328 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.isInstanceWeak | public function isInstanceWeak($instanceName) {
if (isset($this->declaredInstances[$instanceName]['weak'])) {
return $this->declaredInstances[$instanceName]['weak'];
} else {
return false;
}
} | php | public function isInstanceWeak($instanceName) {
if (isset($this->declaredInstances[$instanceName]['weak'])) {
return $this->declaredInstances[$instanceName]['weak'];
} else {
return false;
}
} | [
"public",
"function",
"isInstanceWeak",
"(",
"$",
"instanceName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'weak'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"declaredInstances",... | Returns true if the instance is week
@param string $instanceName
@return bool | [
"Returns",
"true",
"if",
"the",
"instance",
"is",
"week"
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1854-L1860 |
38,329 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.isInstanceAnonymous | public function isInstanceAnonymous($instanceName) {
if (isset($this->declaredInstances[$instanceName]['anonymous'])) {
return $this->declaredInstances[$instanceName]['anonymous'];
} else {
return false;
}
} | php | public function isInstanceAnonymous($instanceName) {
if (isset($this->declaredInstances[$instanceName]['anonymous'])) {
return $this->declaredInstances[$instanceName]['anonymous'];
} else {
return false;
}
} | [
"public",
"function",
"isInstanceAnonymous",
"(",
"$",
"instanceName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'anonymous'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"declaredI... | Returns true if the instance is anonymous
@param string $instanceName
@return bool | [
"Returns",
"true",
"if",
"the",
"instance",
"is",
"anonymous"
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1878-L1884 |
38,330 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.setInstanceAnonymousness | public function setInstanceAnonymousness($instanceName, $anonymous) {
if ($anonymous) {
$this->declaredInstances[$instanceName]['anonymous'] = true;
// An anonymous object must be weak.
$this->declaredInstances[$instanceName]['weak'] = true;
} else {
unset($this->declaredInstances[$instanceName]['anonymous']);
}
} | php | public function setInstanceAnonymousness($instanceName, $anonymous) {
if ($anonymous) {
$this->declaredInstances[$instanceName]['anonymous'] = true;
// An anonymous object must be weak.
$this->declaredInstances[$instanceName]['weak'] = true;
} else {
unset($this->declaredInstances[$instanceName]['anonymous']);
}
} | [
"public",
"function",
"setInstanceAnonymousness",
"(",
"$",
"instanceName",
",",
"$",
"anonymous",
")",
"{",
"if",
"(",
"$",
"anonymous",
")",
"{",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"'anonymous'",
"]",
"=",
"true",
... | Decides whether an instance is anonymous or not.
@param string $instanceName
@param bool $anonymous | [
"Decides",
"whether",
"an",
"instance",
"is",
"anonymous",
"or",
"not",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1891-L1899 |
38,331 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.createInstance | public function createInstance($className, $mode = self::DECLARE_ON_EXIST_EXCEPTION) {
// FIXME: mode is useless here! We are creating an anonymous instance!
$className = ltrim($className, "\\");
$name = $this->getFreeAnonymousName();
$this->declareComponent($name, $className, false, $mode);
$this->setInstanceAnonymousness($name, true);
return $this->getInstanceDescriptor($name);
} | php | public function createInstance($className, $mode = self::DECLARE_ON_EXIST_EXCEPTION) {
// FIXME: mode is useless here! We are creating an anonymous instance!
$className = ltrim($className, "\\");
$name = $this->getFreeAnonymousName();
$this->declareComponent($name, $className, false, $mode);
$this->setInstanceAnonymousness($name, true);
return $this->getInstanceDescriptor($name);
} | [
"public",
"function",
"createInstance",
"(",
"$",
"className",
",",
"$",
"mode",
"=",
"self",
"::",
"DECLARE_ON_EXIST_EXCEPTION",
")",
"{",
"// FIXME: mode is useless here! We are creating an anonymous instance!\r",
"$",
"className",
"=",
"ltrim",
"(",
"$",
"className",
... | Creates a new instance and returns the instance descriptor.
@param string $className The name of the class of the instance.
@param int $mode Depending on the mode, the behaviour will be different if an instance with the same name already exists.
@return MoufInstanceDescriptor | [
"Creates",
"a",
"new",
"instance",
"and",
"returns",
"the",
"instance",
"descriptor",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1956-L1963 |
38,332 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.getClassDescriptor | public function getClassDescriptor($className) {
if (!isset($this->classDescriptors[$className])) {
if (MoufManager::getMoufManager() == null || (MoufManager::getMoufManager()->getScope() == self::SCOPE_APP && $this->getScope() == self::SCOPE_APP)
|| (MoufManager::getMoufManager()->getScope() == self::SCOPE_ADMIN && $this->getScope() == self::SCOPE_ADMIN)) {
// We are fully in the scope of the application:
$this->classDescriptors[$className] = new MoufReflectionClass($className);
} else {
$this->classDescriptors[$className] = MoufReflectionProxy::getClass($className, $this->getScope() == self::SCOPE_ADMIN);
}
}
return $this->classDescriptors[$className];
} | php | public function getClassDescriptor($className) {
if (!isset($this->classDescriptors[$className])) {
if (MoufManager::getMoufManager() == null || (MoufManager::getMoufManager()->getScope() == self::SCOPE_APP && $this->getScope() == self::SCOPE_APP)
|| (MoufManager::getMoufManager()->getScope() == self::SCOPE_ADMIN && $this->getScope() == self::SCOPE_ADMIN)) {
// We are fully in the scope of the application:
$this->classDescriptors[$className] = new MoufReflectionClass($className);
} else {
$this->classDescriptors[$className] = MoufReflectionProxy::getClass($className, $this->getScope() == self::SCOPE_ADMIN);
}
}
return $this->classDescriptors[$className];
} | [
"public",
"function",
"getClassDescriptor",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"classDescriptors",
"[",
"$",
"className",
"]",
")",
")",
"{",
"if",
"(",
"MoufManager",
"::",
"getMoufManager",
"(",
")",
"==",... | Returns an object describing the class passed in parameter.
This method should only be called in the context of the Mouf administration UI.
@param string $className The name of the class to import
@return MoufXmlReflectionClass | [
"Returns",
"an",
"object",
"describing",
"the",
"class",
"passed",
"in",
"parameter",
".",
"This",
"method",
"should",
"only",
"be",
"called",
"in",
"the",
"context",
"of",
"the",
"Mouf",
"administration",
"UI",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L1994-L2005 |
38,333 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.getParameterNames | public function getParameterNames($instanceName) {
return array_merge(
isset($this->declaredInstances[$instanceName]["fieldProperties"])?array_keys($this->declaredInstances[$instanceName]["fieldProperties"]):array(),
isset($this->declaredInstances[$instanceName]["fieldBinds"])?array_keys($this->declaredInstances[$instanceName]["fieldBinds"]):array()
);
} | php | public function getParameterNames($instanceName) {
return array_merge(
isset($this->declaredInstances[$instanceName]["fieldProperties"])?array_keys($this->declaredInstances[$instanceName]["fieldProperties"]):array(),
isset($this->declaredInstances[$instanceName]["fieldBinds"])?array_keys($this->declaredInstances[$instanceName]["fieldBinds"]):array()
);
} | [
"public",
"function",
"getParameterNames",
"(",
"$",
"instanceName",
")",
"{",
"return",
"array_merge",
"(",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"\"fieldProperties\"",
"]",
")",
"?",
"array_keys",
"(",
"$",... | Returns the list of public properties' names configured for this instance.
@param string $instanceName
@return string[] | [
"Returns",
"the",
"list",
"of",
"public",
"properties",
"names",
"configured",
"for",
"this",
"instance",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L2013-L2018 |
38,334 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.getParameterNamesForSetter | public function getParameterNamesForSetter($instanceName) {
return array_merge(
isset($this->declaredInstances[$instanceName]["setterProperties"])?array_keys($this->declaredInstances[$instanceName]["setterProperties"]):array(),
isset($this->declaredInstances[$instanceName]["setterBinds"])?array_keys($this->declaredInstances[$instanceName]["setterBinds"]):array()
);
} | php | public function getParameterNamesForSetter($instanceName) {
return array_merge(
isset($this->declaredInstances[$instanceName]["setterProperties"])?array_keys($this->declaredInstances[$instanceName]["setterProperties"]):array(),
isset($this->declaredInstances[$instanceName]["setterBinds"])?array_keys($this->declaredInstances[$instanceName]["setterBinds"]):array()
);
} | [
"public",
"function",
"getParameterNamesForSetter",
"(",
"$",
"instanceName",
")",
"{",
"return",
"array_merge",
"(",
"isset",
"(",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"instanceName",
"]",
"[",
"\"setterProperties\"",
"]",
")",
"?",
"array_keys",
"... | Returns the list of setters' names configured for this instance.
@param string $instanceName
@return string[] | [
"Returns",
"the",
"list",
"of",
"setters",
"names",
"configured",
"for",
"this",
"instance",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L2026-L2031 |
38,335 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.createInstanceByCode | public function createInstanceByCode() {
$name = $this->getFreeAnonymousName();
$this->declaredInstances[$name]["weak"] = false;
$this->declaredInstances[$name]["comment"] = "";
$this->declaredInstances[$name]["class"] = null;
$this->declaredInstances[$name]["external"] = false;
$this->declaredInstances[$name]["code"] = "";
$this->setInstanceAnonymousness($name, true);
return $this->getInstanceDescriptor($name);
} | php | public function createInstanceByCode() {
$name = $this->getFreeAnonymousName();
$this->declaredInstances[$name]["weak"] = false;
$this->declaredInstances[$name]["comment"] = "";
$this->declaredInstances[$name]["class"] = null;
$this->declaredInstances[$name]["external"] = false;
$this->declaredInstances[$name]["code"] = "";
$this->setInstanceAnonymousness($name, true);
return $this->getInstanceDescriptor($name);
} | [
"public",
"function",
"createInstanceByCode",
"(",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getFreeAnonymousName",
"(",
")",
";",
"$",
"this",
"->",
"declaredInstances",
"[",
"$",
"name",
"]",
"[",
"\"weak\"",
"]",
"=",
"false",
";",
"$",
"this",
... | Creates a new instance declared by PHP code.
@return MoufInstanceDescriptor | [
"Creates",
"a",
"new",
"instance",
"declared",
"by",
"PHP",
"code",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L2052-L2063 |
38,336 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.findInstanceByCallbackType | private function findInstanceByCallbackType($instanceName) {
// Note: we execute the code in another thread. Always.
// This prevent crashing the main thread.
try {
$fullyQualifiedClassName = MoufReflectionProxy::getReturnTypeFromCode($this->declaredInstances[$instanceName]["code"], $this->getScope() == self::SCOPE_ADMIN);
unset($this->declaredInstances[$instanceName]["error"]);
unset($this->declaredInstances[$instanceName]["constructor"]);
unset($this->declaredInstances[$instanceName]["fieldProperties"]);
unset($this->declaredInstances[$instanceName]["setterProperties"]);
unset($this->declaredInstances[$instanceName]["fieldBinds"]);
unset($this->declaredInstances[$instanceName]["setterBinds"]);
$this->declaredInstances[$instanceName]["class"] = $fullyQualifiedClassName;
} catch (\Exception $e) {
$this->declaredInstances[$instanceName]["error"] = $e->getMessage();
unset($this->declaredInstances[$instanceName]["class"]);
$fullyQualifiedClassName = null;
}
return $fullyQualifiedClassName;
} | php | private function findInstanceByCallbackType($instanceName) {
// Note: we execute the code in another thread. Always.
// This prevent crashing the main thread.
try {
$fullyQualifiedClassName = MoufReflectionProxy::getReturnTypeFromCode($this->declaredInstances[$instanceName]["code"], $this->getScope() == self::SCOPE_ADMIN);
unset($this->declaredInstances[$instanceName]["error"]);
unset($this->declaredInstances[$instanceName]["constructor"]);
unset($this->declaredInstances[$instanceName]["fieldProperties"]);
unset($this->declaredInstances[$instanceName]["setterProperties"]);
unset($this->declaredInstances[$instanceName]["fieldBinds"]);
unset($this->declaredInstances[$instanceName]["setterBinds"]);
$this->declaredInstances[$instanceName]["class"] = $fullyQualifiedClassName;
} catch (\Exception $e) {
$this->declaredInstances[$instanceName]["error"] = $e->getMessage();
unset($this->declaredInstances[$instanceName]["class"]);
$fullyQualifiedClassName = null;
}
return $fullyQualifiedClassName;
} | [
"private",
"function",
"findInstanceByCallbackType",
"(",
"$",
"instanceName",
")",
"{",
"// Note: we execute the code in another thread. Always.\r",
"// This prevent crashing the main thread.\r",
"try",
"{",
"$",
"fullyQualifiedClassName",
"=",
"MoufReflectionProxy",
"::",
"getRet... | Returns the type of an instance defined by callback.
For this, the instanciation code will be executed and the result will be returned.
@param string $instanceName The name of the instance to analyze.
@return string | [
"Returns",
"the",
"type",
"of",
"an",
"instance",
"defined",
"by",
"callback",
".",
"For",
"this",
"the",
"instanciation",
"code",
"will",
"be",
"executed",
"and",
"the",
"result",
"will",
"be",
"returned",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L2118-L2136 |
38,337 | thecodingmachine/mouf | src/Mouf/MoufManager.php | MoufManager.walkConstructorLoop | private function walkConstructorLoop($instanceName, array $path) {
if(isset($path[$instanceName])) {
$instances = array_keys($path);
$instances = array_slice($instances, array_search($instanceName, $instances));
throw new MoufContainerException('A loop was detected on constructor arguments '.implode(' -> ', $instances).' -> '.$instanceName);
}
$path[$instanceName] = true;
$descriptor = $this->declaredInstances[$instanceName];
if(isset($descriptor['constructor'])) {
foreach ($descriptor['constructor'] as $constructorArg) {
if($constructorArg['parametertype'] == 'object') {
if(is_array($constructorArg['value'])) {
foreach ($constructorArg['value'] as $subInstanceName) {
if($subInstanceName !== null) {
$this->walkConstructorLoop($subInstanceName, $path);
}
}
}
else {
if($constructorArg['value'] !== null) {
$this->walkConstructorLoop($constructorArg['value'], $path);
}
}
}
}
}
} | php | private function walkConstructorLoop($instanceName, array $path) {
if(isset($path[$instanceName])) {
$instances = array_keys($path);
$instances = array_slice($instances, array_search($instanceName, $instances));
throw new MoufContainerException('A loop was detected on constructor arguments '.implode(' -> ', $instances).' -> '.$instanceName);
}
$path[$instanceName] = true;
$descriptor = $this->declaredInstances[$instanceName];
if(isset($descriptor['constructor'])) {
foreach ($descriptor['constructor'] as $constructorArg) {
if($constructorArg['parametertype'] == 'object') {
if(is_array($constructorArg['value'])) {
foreach ($constructorArg['value'] as $subInstanceName) {
if($subInstanceName !== null) {
$this->walkConstructorLoop($subInstanceName, $path);
}
}
}
else {
if($constructorArg['value'] !== null) {
$this->walkConstructorLoop($constructorArg['value'], $path);
}
}
}
}
}
} | [
"private",
"function",
"walkConstructorLoop",
"(",
"$",
"instanceName",
",",
"array",
"$",
"path",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"path",
"[",
"$",
"instanceName",
"]",
")",
")",
"{",
"$",
"instances",
"=",
"array_keys",
"(",
"$",
"path",
")",... | This take a instance name and the path to access.
It throw an exception if a loop was detected
@param string $instanceName
@param array $path
@throws MoufContainerException | [
"This",
"take",
"a",
"instance",
"name",
"and",
"the",
"path",
"to",
"access",
".",
"It",
"throw",
"an",
"exception",
"if",
"a",
"loop",
"was",
"detected"
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufManager.php#L2166-L2192 |
38,338 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionProxy.php | MoufReflectionProxy.getClass | public static function getClass($className, $selfEdit) {
$url = MoufReflectionProxy::getLocalUrlToProject()."src/direct/get_class.php?class=".$className."&selfedit=".(($selfEdit)?"true":"false");
$response = self::performRequest($url);
return new MoufXmlReflectionClass($response);
} | php | public static function getClass($className, $selfEdit) {
$url = MoufReflectionProxy::getLocalUrlToProject()."src/direct/get_class.php?class=".$className."&selfedit=".(($selfEdit)?"true":"false");
$response = self::performRequest($url);
return new MoufXmlReflectionClass($response);
} | [
"public",
"static",
"function",
"getClass",
"(",
"$",
"className",
",",
"$",
"selfEdit",
")",
"{",
"$",
"url",
"=",
"MoufReflectionProxy",
"::",
"getLocalUrlToProject",
"(",
")",
".",
"\"src/direct/get_class.php?class=\"",
".",
"$",
"className",
".",
"\"&selfedit=... | Returns a MoufXmlReflectionClass representing the class we are going to analyze.
@param string $className
@param boolean $selfEdit
@return MoufXmlReflectionClass | [
"Returns",
"a",
"MoufXmlReflectionClass",
"representing",
"the",
"class",
"we",
"are",
"going",
"to",
"analyze",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionProxy.php#L30-L36 |
38,339 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionProxy.php | MoufReflectionProxy.getAllClasses | public static function getAllClasses($selfEdit, $exportMode = MoufReflectionClass::EXPORT_ALL) {
$url = MoufReflectionProxy::getLocalUrlToProject()."src/direct/get_all_classes.php?selfedit=".(($selfEdit)?"true":"false")."&export_mode=".$exportMode;
$response = self::performRequest($url);
$obj = @unserialize($response);
if ($obj === false) {
throw new Exception("Unable to unserialize message:\n".$response."\n<br/>URL in error: <a href='".plainstring_to_htmlprotected($url, ENT_QUOTES)."'>".plainstring_to_htmlprotected($url, ENT_QUOTES)."</a>");
}
return $obj;
} | php | public static function getAllClasses($selfEdit, $exportMode = MoufReflectionClass::EXPORT_ALL) {
$url = MoufReflectionProxy::getLocalUrlToProject()."src/direct/get_all_classes.php?selfedit=".(($selfEdit)?"true":"false")."&export_mode=".$exportMode;
$response = self::performRequest($url);
$obj = @unserialize($response);
if ($obj === false) {
throw new Exception("Unable to unserialize message:\n".$response."\n<br/>URL in error: <a href='".plainstring_to_htmlprotected($url, ENT_QUOTES)."'>".plainstring_to_htmlprotected($url, ENT_QUOTES)."</a>");
}
return $obj;
} | [
"public",
"static",
"function",
"getAllClasses",
"(",
"$",
"selfEdit",
",",
"$",
"exportMode",
"=",
"MoufReflectionClass",
"::",
"EXPORT_ALL",
")",
"{",
"$",
"url",
"=",
"MoufReflectionProxy",
"::",
"getLocalUrlToProject",
"(",
")",
".",
"\"src/direct/get_all_classe... | Returns the complete list of all classes in a PHP array.
@param boolean $selfEdit
@return array | [
"Returns",
"the",
"complete",
"list",
"of",
"all",
"classes",
"in",
"a",
"PHP",
"array",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionProxy.php#L44-L56 |
38,340 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionProxy.php | MoufReflectionProxy.getConfigConstants | public static function getConfigConstants($selfEdit) {
$url = MoufReflectionProxy::getLocalUrlToProject()."src/direct/get_defined_constants.php?selfedit=".(($selfEdit)?"true":"false");
$response = self::performRequest($url);
$obj = @unserialize($response);
if ($obj === false) {
throw new Exception("Unable to unserialize message:\n".$response."\n<br/>URL in error: <a href='".plainstring_to_htmlprotected($url)."'>".plainstring_to_htmlprotected($url)."</a>");
}
return $obj;
} | php | public static function getConfigConstants($selfEdit) {
$url = MoufReflectionProxy::getLocalUrlToProject()."src/direct/get_defined_constants.php?selfedit=".(($selfEdit)?"true":"false");
$response = self::performRequest($url);
$obj = @unserialize($response);
if ($obj === false) {
throw new Exception("Unable to unserialize message:\n".$response."\n<br/>URL in error: <a href='".plainstring_to_htmlprotected($url)."'>".plainstring_to_htmlprotected($url)."</a>");
}
return $obj;
} | [
"public",
"static",
"function",
"getConfigConstants",
"(",
"$",
"selfEdit",
")",
"{",
"$",
"url",
"=",
"MoufReflectionProxy",
"::",
"getLocalUrlToProject",
"(",
")",
".",
"\"src/direct/get_defined_constants.php?selfedit=\"",
".",
"(",
"(",
"$",
"selfEdit",
")",
"?",... | Returns the array of all constants defined in the config.php file at the root of the project.
@return array | [
"Returns",
"the",
"array",
"of",
"all",
"constants",
"defined",
"in",
"the",
"config",
".",
"php",
"file",
"at",
"the",
"root",
"of",
"the",
"project",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionProxy.php#L114-L127 |
38,341 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionProxy.php | MoufReflectionProxy.analyzeIncludes2 | public static function analyzeIncludes2($selfEdit, $forbiddenClasses) {
$url = MoufReflectionProxy::getLocalUrlToProject()."src/direct/analyze_includes_2.php";
/*foreach ($forbiddenClasses as $forbiddenClass) {
$url .= "&forbiddenClasses[]=".$forbiddenClass;
}*/
$response = self::performRequest($url, array("selfedit"=>json_encode($selfEdit), "classMap"=>json_encode($forbiddenClasses)));
// Let's strip the invalid parts:
/*$arr = explode("\nX4EVDX4SEVX548DSVDXCDSF489\n", $response);
if (count($arr) < 2) {
// No delimiter: there has been a crash.
return array("errorType"=>"crash", "errorMsg"=>$response);
}
$msg = $arr[count($arr)-1];
$obj = unserialize($msg);
if ($obj === false) {
throw new Exception("Unable to unserialize message:\n".$response."\n<br/>URL in error: <a href='".plainstring_to_htmlprotected($url)."'>".plainstring_to_htmlprotected($url)."</a>");
}
return $obj;*/
return $response;
} | php | public static function analyzeIncludes2($selfEdit, $forbiddenClasses) {
$url = MoufReflectionProxy::getLocalUrlToProject()."src/direct/analyze_includes_2.php";
/*foreach ($forbiddenClasses as $forbiddenClass) {
$url .= "&forbiddenClasses[]=".$forbiddenClass;
}*/
$response = self::performRequest($url, array("selfedit"=>json_encode($selfEdit), "classMap"=>json_encode($forbiddenClasses)));
// Let's strip the invalid parts:
/*$arr = explode("\nX4EVDX4SEVX548DSVDXCDSF489\n", $response);
if (count($arr) < 2) {
// No delimiter: there has been a crash.
return array("errorType"=>"crash", "errorMsg"=>$response);
}
$msg = $arr[count($arr)-1];
$obj = unserialize($msg);
if ($obj === false) {
throw new Exception("Unable to unserialize message:\n".$response."\n<br/>URL in error: <a href='".plainstring_to_htmlprotected($url)."'>".plainstring_to_htmlprotected($url)."</a>");
}
return $obj;*/
return $response;
} | [
"public",
"static",
"function",
"analyzeIncludes2",
"(",
"$",
"selfEdit",
",",
"$",
"forbiddenClasses",
")",
"{",
"$",
"url",
"=",
"MoufReflectionProxy",
"::",
"getLocalUrlToProject",
"(",
")",
".",
"\"src/direct/analyze_includes_2.php\"",
";",
"/*foreach ($forbiddenCla... | Analyzes the include files.
@param string $selfEdit
@throws Exception | [
"Analyzes",
"the",
"include",
"files",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionProxy.php#L167-L191 |
38,342 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionProxy.php | MoufReflectionProxy.getReturnTypeFromCode | public static function getReturnTypeFromCode($code, $selfEdit) {
$url = MoufReflectionProxy::getLocalUrlToProject()."src/direct/return_type_from_code.php";
$response = self::performRequest($url,
[
"selfedit"=>($selfEdit)?"true":"false",
"code" => $code
]);
$obj = @unserialize($response);
if ($obj === false) {
throw new Exception($response);
}
return $obj["data"]["class"];
} | php | public static function getReturnTypeFromCode($code, $selfEdit) {
$url = MoufReflectionProxy::getLocalUrlToProject()."src/direct/return_type_from_code.php";
$response = self::performRequest($url,
[
"selfedit"=>($selfEdit)?"true":"false",
"code" => $code
]);
$obj = @unserialize($response);
if ($obj === false) {
throw new Exception($response);
}
return $obj["data"]["class"];
} | [
"public",
"static",
"function",
"getReturnTypeFromCode",
"(",
"$",
"code",
",",
"$",
"selfEdit",
")",
"{",
"$",
"url",
"=",
"MoufReflectionProxy",
"::",
"getLocalUrlToProject",
"(",
")",
".",
"\"src/direct/return_type_from_code.php\"",
";",
"$",
"response",
"=",
"... | Returns the "return" fully qualified class name from the code passed in parameter.
@param string $code
@param bool $selfEdit
@throws Exception
@return string | [
"Returns",
"the",
"return",
"fully",
"qualified",
"class",
"name",
"from",
"the",
"code",
"passed",
"in",
"parameter",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionProxy.php#L224-L241 |
38,343 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionProxy.php | MoufReflectionProxy.performRequest | public static function performRequest($url, $post = array()) {
// preparation de l'envoi
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if($post) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post, '', '&'));
} else {
curl_setopt($ch, CURLOPT_POST, false);
}
if (isset($_SERVER['HTTPS'])) {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
}
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); //Fixes the HTTP/1.1 417 Expectation Failed Bug
// Let's forward all cookies so the session in preserved.
// Problem: because the session file is locked, we cannot do that without closing the session first
session_write_close();
$cookieArr = array();
foreach ($_COOKIE as $key=>$value) {
$cookieArr[] = $key."=".urlencode($value);
}
$cookieStr = implode("; ", $cookieArr);
curl_setopt($ch, CURLOPT_COOKIE, $cookieStr);
$response = curl_exec($ch );
// And let's reopen the session...
session_start();
if( curl_error($ch) ) {
throw new MoufException("An error occurred: ".curl_error($ch));
}
curl_close( $ch );
return $response;
} | php | public static function performRequest($url, $post = array()) {
// preparation de l'envoi
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if($post) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post, '', '&'));
} else {
curl_setopt($ch, CURLOPT_POST, false);
}
if (isset($_SERVER['HTTPS'])) {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
}
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); //Fixes the HTTP/1.1 417 Expectation Failed Bug
// Let's forward all cookies so the session in preserved.
// Problem: because the session file is locked, we cannot do that without closing the session first
session_write_close();
$cookieArr = array();
foreach ($_COOKIE as $key=>$value) {
$cookieArr[] = $key."=".urlencode($value);
}
$cookieStr = implode("; ", $cookieArr);
curl_setopt($ch, CURLOPT_COOKIE, $cookieStr);
$response = curl_exec($ch );
// And let's reopen the session...
session_start();
if( curl_error($ch) ) {
throw new MoufException("An error occurred: ".curl_error($ch));
}
curl_close( $ch );
return $response;
} | [
"public",
"static",
"function",
"performRequest",
"(",
"$",
"url",
",",
"$",
"post",
"=",
"array",
"(",
")",
")",
"{",
"// preparation de l'envoi\r",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_URL",
",",
"$",... | Performs a request using CURL using GET or POST methods and returns the result.
@param string $url
@param array<string, string> $post POST parameters
@throws \Exception | [
"Performs",
"a",
"request",
"using",
"CURL",
"using",
"GET",
"or",
"POST",
"methods",
"and",
"returns",
"the",
"result",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionProxy.php#L271-L313 |
38,344 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionProxy.php | MoufReflectionProxy.performRequestWithoutSession | public static function performRequestWithoutSession($url, $post = array()) {
// preparation de l'envoi
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if($post) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
} else {
curl_setopt($ch, CURLOPT_POST, false);
}
if (isset($_SERVER['HTTPS'])) {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
}
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); //Fixes the HTTP/1.1 417 Expectation Failed Bug
$response = curl_exec($ch );
if( curl_error($ch) ) {
throw new \Exception("An error occured: ".curl_error($ch));
}
curl_close( $ch );
return $response;
} | php | public static function performRequestWithoutSession($url, $post = array()) {
// preparation de l'envoi
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if($post) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
} else {
curl_setopt($ch, CURLOPT_POST, false);
}
if (isset($_SERVER['HTTPS'])) {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
}
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); //Fixes the HTTP/1.1 417 Expectation Failed Bug
$response = curl_exec($ch );
if( curl_error($ch) ) {
throw new \Exception("An error occured: ".curl_error($ch));
}
curl_close( $ch );
return $response;
} | [
"public",
"static",
"function",
"performRequestWithoutSession",
"(",
"$",
"url",
",",
"$",
"post",
"=",
"array",
"(",
")",
")",
"{",
"// preparation de l'envoi\r",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_URL",... | Performs a curl request, same as performRequest, but without using the session nore the cookies...
@param string $url
@param array<string, mixed> $post
@throws \Exception
@return mixed | [
"Performs",
"a",
"curl",
"request",
"same",
"as",
"performRequest",
"but",
"without",
"using",
"the",
"session",
"nore",
"the",
"cookies",
"..."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionProxy.php#L322-L351 |
38,345 | thecodingmachine/mouf | src-dev/Mouf/Controllers/Composer/InstalledPackagesController.php | InstalledPackagesController.search | public function search($text) {
$composerService = new ComposerService(false, true);
ChunckedUtils::init();
$msg = "<script>window.parent.Composer.consoleOutput('Composer is searching...<br/>')</script>";
ChunckedUtils::writeChunk($msg);
$msg = "<script>window.parent.Composer.setSearchStatus(true)</script>";
ChunckedUtils::writeChunk($msg);
$composerService->searchPackages($text, $this);
$msg = "<script>window.parent.Composer.setSearchStatus(false)</script>";
ChunckedUtils::writeChunk($msg);
ChunckedUtils::close();
} | php | public function search($text) {
$composerService = new ComposerService(false, true);
ChunckedUtils::init();
$msg = "<script>window.parent.Composer.consoleOutput('Composer is searching...<br/>')</script>";
ChunckedUtils::writeChunk($msg);
$msg = "<script>window.parent.Composer.setSearchStatus(true)</script>";
ChunckedUtils::writeChunk($msg);
$composerService->searchPackages($text, $this);
$msg = "<script>window.parent.Composer.setSearchStatus(false)</script>";
ChunckedUtils::writeChunk($msg);
ChunckedUtils::close();
} | [
"public",
"function",
"search",
"(",
"$",
"text",
")",
"{",
"$",
"composerService",
"=",
"new",
"ComposerService",
"(",
"false",
",",
"true",
")",
";",
"ChunckedUtils",
"::",
"init",
"(",
")",
";",
"$",
"msg",
"=",
"\"<script>window.parent.Composer.consoleOutp... | Searches the packages and returns a list of matching packages.
@URL composer/search
@param string $text | [
"Searches",
"the",
"packages",
"and",
"returns",
"a",
"list",
"of",
"matching",
"packages",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Controllers/Composer/InstalledPackagesController.php#L98-L115 |
38,346 | thecodingmachine/mouf | src-dev/Mouf/Controllers/Composer/InstalledPackagesController.php | InstalledPackagesController.doInstall | public function doInstall($name, $version, $selfedit = "false") {
$this->selfedit = $selfedit;
if ($selfedit == "true") {
$this->moufManager = MoufManager::getMoufManager();
} else {
$this->moufManager = MoufManager::getMoufManagerHiddenInstance();
}
$composerService = new ComposerService($this->selfedit == "true", true);
ChunckedUtils::init();
$msg = "<script>window.parent.Composer.consoleOutput('Starting installation process...<br/>')</script>";
ChunckedUtils::writeChunk($msg);
$composerService->install($name, $version);
ChunckedUtils::close();
} | php | public function doInstall($name, $version, $selfedit = "false") {
$this->selfedit = $selfedit;
if ($selfedit == "true") {
$this->moufManager = MoufManager::getMoufManager();
} else {
$this->moufManager = MoufManager::getMoufManagerHiddenInstance();
}
$composerService = new ComposerService($this->selfedit == "true", true);
ChunckedUtils::init();
$msg = "<script>window.parent.Composer.consoleOutput('Starting installation process...<br/>')</script>";
ChunckedUtils::writeChunk($msg);
$composerService->install($name, $version);
ChunckedUtils::close();
} | [
"public",
"function",
"doInstall",
"(",
"$",
"name",
",",
"$",
"version",
",",
"$",
"selfedit",
"=",
"\"false\"",
")",
"{",
"$",
"this",
"->",
"selfedit",
"=",
"$",
"selfedit",
";",
"if",
"(",
"$",
"selfedit",
"==",
"\"true\"",
")",
"{",
"$",
"this",... | Actually performs the package installation.
@URL composer/doInstall
@param string $name
@param string $version
@param string $selfedit | [
"Actually",
"performs",
"the",
"package",
"installation",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Controllers/Composer/InstalledPackagesController.php#L198-L218 |
38,347 | thecodingmachine/mouf | src-dev/Mouf/Controllers/Composer/InstalledPackagesController.php | InstalledPackagesController.uninstall | public function uninstall($name, $selfedit = "false") {
$this->selfedit = $selfedit;
$this->name = $name;
if ($selfedit == "true") {
$this->moufManager = MoufManager::getMoufManager();
} else {
$this->moufManager = MoufManager::getMoufManagerHiddenInstance();
}
$this->contentBlock->addFile(ROOT_PATH."src-dev/views/composer/uninstall.php", $this);
$this->template->toHtml();
} | php | public function uninstall($name, $selfedit = "false") {
$this->selfedit = $selfedit;
$this->name = $name;
if ($selfedit == "true") {
$this->moufManager = MoufManager::getMoufManager();
} else {
$this->moufManager = MoufManager::getMoufManagerHiddenInstance();
}
$this->contentBlock->addFile(ROOT_PATH."src-dev/views/composer/uninstall.php", $this);
$this->template->toHtml();
} | [
"public",
"function",
"uninstall",
"(",
"$",
"name",
",",
"$",
"selfedit",
"=",
"\"false\"",
")",
"{",
"$",
"this",
"->",
"selfedit",
"=",
"$",
"selfedit",
";",
"$",
"this",
"->",
"name",
"=",
"$",
"name",
";",
"if",
"(",
"$",
"selfedit",
"==",
"\"... | Triggers the removal of the composer package passed in parameter.
This will actually display a screen with an iframe that will do the real uninstall process.
@Post
@URL composer/uninstall
@param string $name
@param string $selfedit | [
"Triggers",
"the",
"removal",
"of",
"the",
"composer",
"package",
"passed",
"in",
"parameter",
".",
"This",
"will",
"actually",
"display",
"a",
"screen",
"with",
"an",
"iframe",
"that",
"will",
"do",
"the",
"real",
"uninstall",
"process",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Controllers/Composer/InstalledPackagesController.php#L229-L241 |
38,348 | thecodingmachine/mouf | src-dev/Mouf/Controllers/Composer/InstalledPackagesController.php | InstalledPackagesController.doUninstall | public function doUninstall($name, $selfedit = "false") {
$this->selfedit = $selfedit;
if ($selfedit == "true") {
$this->moufManager = MoufManager::getMoufManager();
} else {
$this->moufManager = MoufManager::getMoufManagerHiddenInstance();
}
$composerService = new ComposerService($this->selfedit == "true", true);
ChunckedUtils::init();
$msg = "<script>window.parent.Composer.consoleOutput('Starting uninstall process...<br/>')</script>";
ChunckedUtils::writeChunk($msg);
$composerService->uninstall($name);
ChunckedUtils::close();
} | php | public function doUninstall($name, $selfedit = "false") {
$this->selfedit = $selfedit;
if ($selfedit == "true") {
$this->moufManager = MoufManager::getMoufManager();
} else {
$this->moufManager = MoufManager::getMoufManagerHiddenInstance();
}
$composerService = new ComposerService($this->selfedit == "true", true);
ChunckedUtils::init();
$msg = "<script>window.parent.Composer.consoleOutput('Starting uninstall process...<br/>')</script>";
ChunckedUtils::writeChunk($msg);
$composerService->uninstall($name);
ChunckedUtils::close();
} | [
"public",
"function",
"doUninstall",
"(",
"$",
"name",
",",
"$",
"selfedit",
"=",
"\"false\"",
")",
"{",
"$",
"this",
"->",
"selfedit",
"=",
"$",
"selfedit",
";",
"if",
"(",
"$",
"selfedit",
"==",
"\"true\"",
")",
"{",
"$",
"this",
"->",
"moufManager",... | Actually performs the package removal.
@URL composer/doUninstall
@param string $name
@param string $selfedit | [
"Actually",
"performs",
"the",
"package",
"removal",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Controllers/Composer/InstalledPackagesController.php#L250-L270 |
38,349 | thecodingmachine/mouf | src/Mouf/Reflection/MoufXmlReflectionParameter.php | MoufXmlReflectionParameter.getDeclaringFunction | public function getDeclaringFunction()
{
if (null === $this->refRoutine) {
if (is_array($this->routineName) === true) {
$this->refRoutine = new MoufReflectionMethod($this->routineName[0], $this->routineName[1]);
}
}
return $this->refRoutine;
} | php | public function getDeclaringFunction()
{
if (null === $this->refRoutine) {
if (is_array($this->routineName) === true) {
$this->refRoutine = new MoufReflectionMethod($this->routineName[0], $this->routineName[1]);
}
}
return $this->refRoutine;
} | [
"public",
"function",
"getDeclaringFunction",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"refRoutine",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"routineName",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"refRoutine... | helper method to return the reflection routine defining this parameter
@return MoufReflectionMethod | [
"helper",
"method",
"to",
"return",
"the",
"reflection",
"routine",
"defining",
"this",
"parameter"
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufXmlReflectionParameter.php#L81-L90 |
38,350 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionClass.php | MoufReflectionClass.getMethodsByPattern | public function getMethodsByPattern($regex)
{
$methods = parent::getMethods();
$moufMethods = array();
foreach ($methods as $method) {
if (preg_match("/$regex/", $method->getName())) {
$moufMethods[$method->getName()] = new MoufReflectionMethod($this, $method->getName());
}
}
return $moufMethods;
} | php | public function getMethodsByPattern($regex)
{
$methods = parent::getMethods();
$moufMethods = array();
foreach ($methods as $method) {
if (preg_match("/$regex/", $method->getName())) {
$moufMethods[$method->getName()] = new MoufReflectionMethod($this, $method->getName());
}
}
return $moufMethods;
} | [
"public",
"function",
"getMethodsByPattern",
"(",
"$",
"regex",
")",
"{",
"$",
"methods",
"=",
"parent",
"::",
"getMethods",
"(",
")",
";",
"$",
"moufMethods",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"methods",
"as",
"$",
"method",
")",
"{",
... | returns a list of all methods matching a given regex
@param string $regex the regex to macth
@return array<MoufReflectionMethod> | [
"returns",
"a",
"list",
"of",
"all",
"methods",
"matching",
"a",
"given",
"regex"
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionClass.php#L177-L188 |
38,351 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionClass.php | MoufReflectionClass.getExtension | public function getExtension()
{
$extensionName = $this->getExtensionName();
if (null === $extensionName || false === $extensionName) {
return null;
}
$moufRefExtension = new MoufReflectionExtension($extensionName);
return $moufRefExtension;
} | php | public function getExtension()
{
$extensionName = $this->getExtensionName();
if (null === $extensionName || false === $extensionName) {
return null;
}
$moufRefExtension = new MoufReflectionExtension($extensionName);
return $moufRefExtension;
} | [
"public",
"function",
"getExtension",
"(",
")",
"{",
"$",
"extensionName",
"=",
"$",
"this",
"->",
"getExtensionName",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"extensionName",
"||",
"false",
"===",
"$",
"extensionName",
")",
"{",
"return",
"null",
... | returns the extension to where this class belongs too
@return MoufReflectionExtension | [
"returns",
"the",
"extension",
"to",
"where",
"this",
"class",
"belongs",
"too"
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionClass.php#L327-L336 |
38,352 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionClass.php | MoufReflectionClass.getInjectablePropertiesByConstructor | public function getInjectablePropertiesByConstructor() {
if ($this->injectablePropertiesByConstructor === null) {
$moufProperties = array();
$constructor = $this->getConstructor();
if ($constructor != null) {
foreach($constructor->getParameters() as $parameter) {
$propertyDescriptor = new MoufPropertyDescriptor($parameter);
$moufProperties[$propertyDescriptor->getName()] = $propertyDescriptor;
}
}
$this->injectablePropertiesByConstructor = $moufProperties;
}
return $this->injectablePropertiesByConstructor;
} | php | public function getInjectablePropertiesByConstructor() {
if ($this->injectablePropertiesByConstructor === null) {
$moufProperties = array();
$constructor = $this->getConstructor();
if ($constructor != null) {
foreach($constructor->getParameters() as $parameter) {
$propertyDescriptor = new MoufPropertyDescriptor($parameter);
$moufProperties[$propertyDescriptor->getName()] = $propertyDescriptor;
}
}
$this->injectablePropertiesByConstructor = $moufProperties;
}
return $this->injectablePropertiesByConstructor;
} | [
"public",
"function",
"getInjectablePropertiesByConstructor",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"injectablePropertiesByConstructor",
"===",
"null",
")",
"{",
"$",
"moufProperties",
"=",
"array",
"(",
")",
";",
"$",
"constructor",
"=",
"$",
"this",
"... | Returns the list of MoufPropertyDescriptor that can be injected via the constructor.
@return MoufPropertyDescriptor[] An associative array. The key is the name of the argument. | [
"Returns",
"the",
"list",
"of",
"MoufPropertyDescriptor",
"that",
"can",
"be",
"injected",
"via",
"the",
"constructor",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionClass.php#L387-L400 |
38,353 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionClass.php | MoufReflectionClass.getInjectablePropertiesByPublicProperty | public function getInjectablePropertiesByPublicProperty() {
if ($this->injectablePropertiesByPublicProperty === null) {
$moufProperties = array();
foreach($this->getProperties() as $attribute) {
/* @var $attribute MoufXmlReflectionProperty */
//if ($attribute->hasAnnotation("Property")) {
if ($attribute->isPublic() && !$attribute->isStatic()) {
// We might want to catch it and to display it properly
$propertyDescriptor = new MoufPropertyDescriptor($attribute);
$moufProperties[$attribute->getName()] = $propertyDescriptor;
}
//}
}
$this->injectablePropertiesByPublicProperty = $moufProperties;
}
return $this->injectablePropertiesByPublicProperty;
} | php | public function getInjectablePropertiesByPublicProperty() {
if ($this->injectablePropertiesByPublicProperty === null) {
$moufProperties = array();
foreach($this->getProperties() as $attribute) {
/* @var $attribute MoufXmlReflectionProperty */
//if ($attribute->hasAnnotation("Property")) {
if ($attribute->isPublic() && !$attribute->isStatic()) {
// We might want to catch it and to display it properly
$propertyDescriptor = new MoufPropertyDescriptor($attribute);
$moufProperties[$attribute->getName()] = $propertyDescriptor;
}
//}
}
$this->injectablePropertiesByPublicProperty = $moufProperties;
}
return $this->injectablePropertiesByPublicProperty;
} | [
"public",
"function",
"getInjectablePropertiesByPublicProperty",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"injectablePropertiesByPublicProperty",
"===",
"null",
")",
"{",
"$",
"moufProperties",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
... | Returns the list of MoufPropertyDescriptor that can be injected via a public property of the class.
@return MoufPropertyDescriptor[] An associative array. The key is the name of the argument. | [
"Returns",
"the",
"list",
"of",
"MoufPropertyDescriptor",
"that",
"can",
"be",
"injected",
"via",
"a",
"public",
"property",
"of",
"the",
"class",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionClass.php#L424-L440 |
38,354 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionClass.php | MoufReflectionClass.staticGetInjectablePropertiesBySetter | public static function staticGetInjectablePropertiesBySetter(MoufReflectionClassInterface $refClass) {
$moufProperties = array();
foreach($refClass->getMethodsByPattern('^set..*') as $method) {
/* @var $attribute MoufXmlReflectionProperty */
//if ($method->hasAnnotation("Property")) {
$parameters = $method->getParameters();
if (count($parameters) == 0) {
continue;
}
if (count($parameters)>1) {
$ko = false;
for ($i=1, $count=count($parameters); $i<$count; $i++) {
$param = $parameters[$i];
if (!$param->isDefaultValueAvailable()) {
$ko = true;
}
}
if ($ko) {
continue;
}
}
$propertyDescriptor = new MoufPropertyDescriptor($method);
$moufProperties[$method->getName()] = $propertyDescriptor;
//}
}
return $moufProperties;
} | php | public static function staticGetInjectablePropertiesBySetter(MoufReflectionClassInterface $refClass) {
$moufProperties = array();
foreach($refClass->getMethodsByPattern('^set..*') as $method) {
/* @var $attribute MoufXmlReflectionProperty */
//if ($method->hasAnnotation("Property")) {
$parameters = $method->getParameters();
if (count($parameters) == 0) {
continue;
}
if (count($parameters)>1) {
$ko = false;
for ($i=1, $count=count($parameters); $i<$count; $i++) {
$param = $parameters[$i];
if (!$param->isDefaultValueAvailable()) {
$ko = true;
}
}
if ($ko) {
continue;
}
}
$propertyDescriptor = new MoufPropertyDescriptor($method);
$moufProperties[$method->getName()] = $propertyDescriptor;
//}
}
return $moufProperties;
} | [
"public",
"static",
"function",
"staticGetInjectablePropertiesBySetter",
"(",
"MoufReflectionClassInterface",
"$",
"refClass",
")",
"{",
"$",
"moufProperties",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"refClass",
"->",
"getMethodsByPattern",
"(",
"'^set..*'",... | We need this static method because we cannot use traits for PHP 5.3 that would have been useful
to provide those methods to both MoufReflectionClass and MoufXMLReflectionClass.
@param MoufReflectionClassInterface $refClass
@return multitype:\Mouf\MoufPropertyDescriptor | [
"We",
"need",
"this",
"static",
"method",
"because",
"we",
"cannot",
"use",
"traits",
"for",
"PHP",
"5",
".",
"3",
"that",
"would",
"have",
"been",
"useful",
"to",
"provide",
"those",
"methods",
"to",
"both",
"MoufReflectionClass",
"and",
"MoufXMLReflectionCla... | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionClass.php#L477-L505 |
38,355 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionClass.php | MoufReflectionClass.getLastModificationDate | protected function getLastModificationDate() {
$parent = $this->getParentClass();
if ($parent != null) {
return max(filemtime($this->getFileName()), $parent->getLastModificationDate());
} else {
return filemtime($this->getFileName());
}
} | php | protected function getLastModificationDate() {
$parent = $this->getParentClass();
if ($parent != null) {
return max(filemtime($this->getFileName()), $parent->getLastModificationDate());
} else {
return filemtime($this->getFileName());
}
} | [
"protected",
"function",
"getLastModificationDate",
"(",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"getParentClass",
"(",
")",
";",
"if",
"(",
"$",
"parent",
"!=",
"null",
")",
"{",
"return",
"max",
"(",
"filemtime",
"(",
"$",
"this",
"->",
"get... | Returns the last modification date of this file or one of the parent classes of this file.
This return actually the last modification date of this file and all parents classes.
This is useful to discard cache records if this file or one of its parents is updated.
TODO: take traits into account. | [
"Returns",
"the",
"last",
"modification",
"date",
"of",
"this",
"file",
"or",
"one",
"of",
"the",
"parent",
"classes",
"of",
"this",
"file",
".",
"This",
"return",
"actually",
"the",
"last",
"modification",
"date",
"of",
"this",
"file",
"and",
"all",
"pare... | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionClass.php#L565-L572 |
38,356 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionClass.php | MoufReflectionClass.getUseNamespaces | public function getUseNamespaces() {
if ($this->useNamespaces === null) {
$this->useNamespaces = array();
// Optim from Doctrine / Symfony 2: let's not analyze the "use" statements after the start of the class!
$contents = $this->getFileContent($this->getFileName(), $this->getStartLine());
//$contents = file_get_contents($this->getFileName());
// Optim to avoid doing the token_get_all think that is costly.
if (strpos($contents, 'use ') === false) {
return array();
}
$tokens = token_get_all($contents);
$classes = array();
//$namespace = '';
for ($i = 0, $max = count($tokens); $i < $max; $i++) {
$token = $tokens[$i];
if (is_string($token)) {
continue;
}
$class = '';
$path = '';
if ($token[0] == T_USE) {
while (($t = $tokens[++$i]) && is_array($t)) {
//if (in_array($t[0], array(T_STRING, T_NS_SEPARATOR))) {
$type = $t[0];
if ($type == T_STRING || $type == T_NS_SEPARATOR) {
$path .= $t[1];
if ($type == T_STRING) {
$as = $t[1];
}
} elseif ($type === T_AS) {
break;
}
}
if (empty($path)) {
// Path can be empty if the USE statement is not at the beginning of the file but part of a closure
// (function() use ($var))
continue;
}
$nextToken = $tokens[$i];
if ($nextToken[0] === T_AS) {
$i += 2;
$as = $tokens[$i][1];
}
$path = ltrim($path, '\\');
$this->useNamespaces[$as] = $path;
}
}
}
return $this->useNamespaces;
} | php | public function getUseNamespaces() {
if ($this->useNamespaces === null) {
$this->useNamespaces = array();
// Optim from Doctrine / Symfony 2: let's not analyze the "use" statements after the start of the class!
$contents = $this->getFileContent($this->getFileName(), $this->getStartLine());
//$contents = file_get_contents($this->getFileName());
// Optim to avoid doing the token_get_all think that is costly.
if (strpos($contents, 'use ') === false) {
return array();
}
$tokens = token_get_all($contents);
$classes = array();
//$namespace = '';
for ($i = 0, $max = count($tokens); $i < $max; $i++) {
$token = $tokens[$i];
if (is_string($token)) {
continue;
}
$class = '';
$path = '';
if ($token[0] == T_USE) {
while (($t = $tokens[++$i]) && is_array($t)) {
//if (in_array($t[0], array(T_STRING, T_NS_SEPARATOR))) {
$type = $t[0];
if ($type == T_STRING || $type == T_NS_SEPARATOR) {
$path .= $t[1];
if ($type == T_STRING) {
$as = $t[1];
}
} elseif ($type === T_AS) {
break;
}
}
if (empty($path)) {
// Path can be empty if the USE statement is not at the beginning of the file but part of a closure
// (function() use ($var))
continue;
}
$nextToken = $tokens[$i];
if ($nextToken[0] === T_AS) {
$i += 2;
$as = $tokens[$i][1];
}
$path = ltrim($path, '\\');
$this->useNamespaces[$as] = $path;
}
}
}
return $this->useNamespaces;
} | [
"public",
"function",
"getUseNamespaces",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useNamespaces",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"useNamespaces",
"=",
"array",
"(",
")",
";",
"// Optim from Doctrine / Symfony 2: let's not analyze the \"use\" state... | For the current class, returns a list of "use" statement used in the file for that class.
The key is the "alias" of the path, and the value the path.
So if you have:
use Mouf\Mvc\Splash\Controller as SplashController
the key will be "SplashController" and the value "Mouf\Mvc\Splash\Controller"
Similarly, if you have only
use Mouf\Mvc\Splash\Controller
the key will be "Controller" and the value "Mouf\Mvc\Splash\Controller"
@return array<string, string> | [
"For",
"the",
"current",
"class",
"returns",
"a",
"list",
"of",
"use",
"statement",
"used",
"in",
"the",
"file",
"for",
"that",
"class",
".",
"The",
"key",
"is",
"the",
"alias",
"of",
"the",
"path",
"and",
"the",
"value",
"the",
"path",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionClass.php#L697-L759 |
38,357 | thecodingmachine/mouf | src/Mouf/Reflection/MoufPhpDocComment.php | MoufPhpDocComment.parse | private function parse($docComment) {
$lines = self::getDocLinesFromComment($docComment);
// First, let's go to the first Annotation.
// Anything before is the pure comment.
$annotationLines = array();
$oneAnnotationFound = false;
// Is the line an annotation? Let's test this with a regexp.
foreach ($lines as $line) {
if (preg_match("/^[@][a-zA-Z]/", $line) === 0) {
if ($oneAnnotationFound == false) {
$this->comment .= $line."\n";
}
} else {
$this->parseAnnotation($line);
$oneAnnotationFound = true;
}
}
} | php | private function parse($docComment) {
$lines = self::getDocLinesFromComment($docComment);
// First, let's go to the first Annotation.
// Anything before is the pure comment.
$annotationLines = array();
$oneAnnotationFound = false;
// Is the line an annotation? Let's test this with a regexp.
foreach ($lines as $line) {
if (preg_match("/^[@][a-zA-Z]/", $line) === 0) {
if ($oneAnnotationFound == false) {
$this->comment .= $line."\n";
}
} else {
$this->parseAnnotation($line);
$oneAnnotationFound = true;
}
}
} | [
"private",
"function",
"parse",
"(",
"$",
"docComment",
")",
"{",
"$",
"lines",
"=",
"self",
"::",
"getDocLinesFromComment",
"(",
"$",
"docComment",
")",
";",
"// First, let's go to the first Annotation.\r",
"// Anything before is the pure comment.\r",
"$",
"annotationLin... | Parses the doc comment and initilizes all the values of interest.
@param string $docComment | [
"Parses",
"the",
"doc",
"comment",
"and",
"initilizes",
"all",
"the",
"values",
"of",
"interest",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufPhpDocComment.php#L59-L78 |
38,358 | thecodingmachine/mouf | src/Mouf/Reflection/MoufPhpDocComment.php | MoufPhpDocComment.parseAnnotation | private function parseAnnotation($line) {
// Let's get the annotation text
preg_match("/^[@]([a-zA-Z][a-zA-Z0-9]*)(.*)/", $line, $values);
$annotationClass = isset($values[1])?$values[1]:null;
$annotationParams = trim(isset($values[2])?$values[2]:null);
$this->annotationsArrayAsString[$annotationClass][] = $annotationParams;
} | php | private function parseAnnotation($line) {
// Let's get the annotation text
preg_match("/^[@]([a-zA-Z][a-zA-Z0-9]*)(.*)/", $line, $values);
$annotationClass = isset($values[1])?$values[1]:null;
$annotationParams = trim(isset($values[2])?$values[2]:null);
$this->annotationsArrayAsString[$annotationClass][] = $annotationParams;
} | [
"private",
"function",
"parseAnnotation",
"(",
"$",
"line",
")",
"{",
"// Let's get the annotation text\r",
"preg_match",
"(",
"\"/^[@]([a-zA-Z][a-zA-Z0-9]*)(.*)/\"",
",",
"$",
"line",
",",
"$",
"values",
")",
";",
"$",
"annotationClass",
"=",
"isset",
"(",
"$",
"... | Parses an annotation line and stores the result in the MoufPhpDocComment.
@param string $line | [
"Parses",
"an",
"annotation",
"line",
"and",
"stores",
"the",
"result",
"in",
"the",
"MoufPhpDocComment",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufPhpDocComment.php#L85-L93 |
38,359 | thecodingmachine/mouf | src/Mouf/Reflection/MoufPhpDocComment.php | MoufPhpDocComment.getDocLinesFromComment | private static function getDocLinesFromComment($docComment) {
if (strpos($docComment, "/**") === 0) {
$docComment = substr($docComment, 3);
}
// Let's remove all the \r...
$docComment = str_replace("\r", "", $docComment);
$commentLines = explode("\n", $docComment);
$commentLinesWithoutStars = array();
// For each line, let's remove the first spaces, and the first *
foreach ($commentLines as $commentLine) {
$length = strlen($commentLine);
for ($i=0; $i<$length; $i++) {
if ($commentLine{$i} != ' ' && $commentLine{$i} != '*' && $commentLine{$i} != "\t") {
break;
}
}
$commentLinesWithoutStars[] = substr($commentLine, $i);
}
// Let's remove the trailing /:
$lastComment = $commentLinesWithoutStars[count($commentLinesWithoutStars)-1];
$commentLinesWithoutStars[count($commentLinesWithoutStars)-1] = substr($lastComment, 0, strlen($lastComment)-1);
if ($commentLinesWithoutStars[count($commentLinesWithoutStars)-1] == "")
array_pop($commentLinesWithoutStars);
if (isset($commentLinesWithoutStars[0]) && $commentLinesWithoutStars[0] == "") {
$commentLinesWithoutStars = array_slice($commentLinesWithoutStars, 1);
}
return $commentLinesWithoutStars;
} | php | private static function getDocLinesFromComment($docComment) {
if (strpos($docComment, "/**") === 0) {
$docComment = substr($docComment, 3);
}
// Let's remove all the \r...
$docComment = str_replace("\r", "", $docComment);
$commentLines = explode("\n", $docComment);
$commentLinesWithoutStars = array();
// For each line, let's remove the first spaces, and the first *
foreach ($commentLines as $commentLine) {
$length = strlen($commentLine);
for ($i=0; $i<$length; $i++) {
if ($commentLine{$i} != ' ' && $commentLine{$i} != '*' && $commentLine{$i} != "\t") {
break;
}
}
$commentLinesWithoutStars[] = substr($commentLine, $i);
}
// Let's remove the trailing /:
$lastComment = $commentLinesWithoutStars[count($commentLinesWithoutStars)-1];
$commentLinesWithoutStars[count($commentLinesWithoutStars)-1] = substr($lastComment, 0, strlen($lastComment)-1);
if ($commentLinesWithoutStars[count($commentLinesWithoutStars)-1] == "")
array_pop($commentLinesWithoutStars);
if (isset($commentLinesWithoutStars[0]) && $commentLinesWithoutStars[0] == "") {
$commentLinesWithoutStars = array_slice($commentLinesWithoutStars, 1);
}
return $commentLinesWithoutStars;
} | [
"private",
"static",
"function",
"getDocLinesFromComment",
"(",
"$",
"docComment",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"docComment",
",",
"\"/**\"",
")",
"===",
"0",
")",
"{",
"$",
"docComment",
"=",
"substr",
"(",
"$",
"docComment",
",",
"3",
")",
... | Returns an array of lines of the comments.
@param string $docComment
@return array | [
"Returns",
"an",
"array",
"of",
"lines",
"of",
"the",
"comments",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufPhpDocComment.php#L101-L135 |
38,360 | thecodingmachine/mouf | src/Mouf/Reflection/MoufPhpDocComment.php | MoufPhpDocComment.getAllAnnotations | public function getAllAnnotations() {
$retArray = array();
if (!$this->annotationsArrayAsString) {
return array();
}
foreach ($this->annotationsArrayAsString as $key=>$value) {
$retArray[$key] = $this->getAnnotations($key);
}
return $retArray;
} | php | public function getAllAnnotations() {
$retArray = array();
if (!$this->annotationsArrayAsString) {
return array();
}
foreach ($this->annotationsArrayAsString as $key=>$value) {
$retArray[$key] = $this->getAnnotations($key);
}
return $retArray;
} | [
"public",
"function",
"getAllAnnotations",
"(",
")",
"{",
"$",
"retArray",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"annotationsArrayAsString",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
... | Returns a map associating the annotation title to an array of objects representing the annotation.
@var array("annotationClass"=>array($annotationObjects)) | [
"Returns",
"a",
"map",
"associating",
"the",
"annotation",
"title",
"to",
"an",
"array",
"of",
"objects",
"representing",
"the",
"annotation",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufPhpDocComment.php#L225-L234 |
38,361 | Lecturize/Laravel-Taxonomies | src/Models/Taxonomy.php | Taxonomy.scopeTerm | public function scopeTerm($query, $term, $taxonomy = 'major')
{
return $query->whereHas('term', function($q) use($term, $taxonomy) {
$q->where('name', $term);
});
} | php | public function scopeTerm($query, $term, $taxonomy = 'major')
{
return $query->whereHas('term', function($q) use($term, $taxonomy) {
$q->where('name', $term);
});
} | [
"public",
"function",
"scopeTerm",
"(",
"$",
"query",
",",
"$",
"term",
",",
"$",
"taxonomy",
"=",
"'major'",
")",
"{",
"return",
"$",
"query",
"->",
"whereHas",
"(",
"'term'",
",",
"function",
"(",
"$",
"q",
")",
"use",
"(",
"$",
"term",
",",
"$",... | Scope terms.
@param object $query
@param string $term
@param string $taxonomy
@return mixed | [
"Scope",
"terms",
"."
] | 46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be | https://github.com/Lecturize/Laravel-Taxonomies/blob/46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be/src/Models/Taxonomy.php#L99-L104 |
38,362 | Lecturize/Laravel-Taxonomies | src/Models/Taxonomy.php | Taxonomy.scopeSearch | public function scopeSearch($query, $searchTerm, $taxonomy = 'major')
{
return $query->whereHas('term', function($q) use($searchTerm, $taxonomy) {
$q->where('name', 'like', '%'. $searchTerm .'%');
});
} | php | public function scopeSearch($query, $searchTerm, $taxonomy = 'major')
{
return $query->whereHas('term', function($q) use($searchTerm, $taxonomy) {
$q->where('name', 'like', '%'. $searchTerm .'%');
});
} | [
"public",
"function",
"scopeSearch",
"(",
"$",
"query",
",",
"$",
"searchTerm",
",",
"$",
"taxonomy",
"=",
"'major'",
")",
"{",
"return",
"$",
"query",
"->",
"whereHas",
"(",
"'term'",
",",
"function",
"(",
"$",
"q",
")",
"use",
"(",
"$",
"searchTerm",... | A simple search scope.
@param object $query
@param string $searchTerm
@param string $taxonomy
@return mixed | [
"A",
"simple",
"search",
"scope",
"."
] | 46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be | https://github.com/Lecturize/Laravel-Taxonomies/blob/46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be/src/Models/Taxonomy.php#L114-L119 |
38,363 | thecodingmachine/mouf | src-dev/Mouf/Controllers/MoufDisplayGraphController.php | MoufDisplayGraphController.defaultAction | public function defaultAction($name, $selfedit = false) {
$this->initController($name, $selfedit);
$template = $this->template;
$this->template->addHeadHtmlElement(new HtmlJSJit());
$this->template->addJsFile(ROOT_URL."src-dev/views/displayGraph.js");
$template->addContentFile(dirname(__FILE__)."/../views/displayGraph.php", $this);
$template->toHtml();
} | php | public function defaultAction($name, $selfedit = false) {
$this->initController($name, $selfedit);
$template = $this->template;
$this->template->addHeadHtmlElement(new HtmlJSJit());
$this->template->addJsFile(ROOT_URL."src-dev/views/displayGraph.js");
$template->addContentFile(dirname(__FILE__)."/../views/displayGraph.php", $this);
$template->toHtml();
} | [
"public",
"function",
"defaultAction",
"(",
"$",
"name",
",",
"$",
"selfedit",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"initController",
"(",
"$",
"name",
",",
"$",
"selfedit",
")",
";",
"$",
"template",
"=",
"$",
"this",
"->",
"template",
";",
"$... | Displays the dependency graph around the component passed in parameter.
@Action
@Logged
@param string $name
@param string $selfedit | [
"Displays",
"the",
"dependency",
"graph",
"around",
"the",
"component",
"passed",
"in",
"parameter",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Controllers/MoufDisplayGraphController.php#L30-L38 |
38,364 | thecodingmachine/mouf | src-dev/Mouf/Controllers/MoufDisplayGraphController.php | MoufDisplayGraphController.getJitJsonNode | private function getJitJsonNode($instanceName) {
$node = array();
$node["id"] = $instanceName;
$node["name"] = $instanceName;
// We can set some data (dimension, other keys...) but we will keep tht to 0 for now.
$adjacencies = array();
$componentsList = $this->getComponentsListBoundToInstance($instanceName);
foreach ($componentsList as $component) {
$adjacency = array();
$adjacency['nodeTo'] = $component;
// We can set some data (weight...) but we will keep tht to 0 for now.
$data = array();
$data['$type'] = "arrow";
$data['$direction'] = array($instanceName, $component);
/* "data": {
"$type":"arrow",
"$direction": ["node4", "node3"],
"$dim":25,
"$color":"#dd99dd",
"weight": 1
}*/
$adjacency['data'] = $data;
$adjacencies[] = $adjacency;
}
$node["adjacencies"] = $adjacencies;
return $node;
} | php | private function getJitJsonNode($instanceName) {
$node = array();
$node["id"] = $instanceName;
$node["name"] = $instanceName;
// We can set some data (dimension, other keys...) but we will keep tht to 0 for now.
$adjacencies = array();
$componentsList = $this->getComponentsListBoundToInstance($instanceName);
foreach ($componentsList as $component) {
$adjacency = array();
$adjacency['nodeTo'] = $component;
// We can set some data (weight...) but we will keep tht to 0 for now.
$data = array();
$data['$type'] = "arrow";
$data['$direction'] = array($instanceName, $component);
/* "data": {
"$type":"arrow",
"$direction": ["node4", "node3"],
"$dim":25,
"$color":"#dd99dd",
"weight": 1
}*/
$adjacency['data'] = $data;
$adjacencies[] = $adjacency;
}
$node["adjacencies"] = $adjacencies;
return $node;
} | [
"private",
"function",
"getJitJsonNode",
"(",
"$",
"instanceName",
")",
"{",
"$",
"node",
"=",
"array",
"(",
")",
";",
"$",
"node",
"[",
"\"id\"",
"]",
"=",
"$",
"instanceName",
";",
"$",
"node",
"[",
"\"name\"",
"]",
"=",
"$",
"instanceName",
";",
"... | Returns a PHP array representing a node that will be used by JIT to build a visual representation. | [
"Returns",
"a",
"PHP",
"array",
"representing",
"a",
"node",
"that",
"will",
"be",
"used",
"by",
"JIT",
"to",
"build",
"a",
"visual",
"representation",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Controllers/MoufDisplayGraphController.php#L142-L178 |
38,365 | thecodingmachine/mouf | src-dev/Mouf/Controllers/MoufDisplayGraphController.php | MoufDisplayGraphController.getComponentsListBoundToInstance | private function getComponentsListBoundToInstance($instanceName) {
$componentsList = array();
$boundComponents = $this->moufManager->getBoundComponents($instanceName);
if (is_array($boundComponents)) {
foreach ($boundComponents as $property=>$components) {
if (is_array($components)) {
$componentsList = array_merge($componentsList, $components);
} else {
$componentsList[] = $components;
}
}
}
return $componentsList;
} | php | private function getComponentsListBoundToInstance($instanceName) {
$componentsList = array();
$boundComponents = $this->moufManager->getBoundComponents($instanceName);
if (is_array($boundComponents)) {
foreach ($boundComponents as $property=>$components) {
if (is_array($components)) {
$componentsList = array_merge($componentsList, $components);
} else {
$componentsList[] = $components;
}
}
}
return $componentsList;
} | [
"private",
"function",
"getComponentsListBoundToInstance",
"(",
"$",
"instanceName",
")",
"{",
"$",
"componentsList",
"=",
"array",
"(",
")",
";",
"$",
"boundComponents",
"=",
"$",
"this",
"->",
"moufManager",
"->",
"getBoundComponents",
"(",
"$",
"instanceName",
... | Returns the list of components that this component possesses bindings on.
@param string $instanceName
@return array<string> | [
"Returns",
"the",
"list",
"of",
"components",
"that",
"this",
"component",
"possesses",
"bindings",
"on",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Controllers/MoufDisplayGraphController.php#L186-L200 |
38,366 | thecodingmachine/mouf | src-dev/Mouf/Validator/MoufValidatorService.php | MoufValidatorService.registerBasicValidator | public function registerBasicValidator($name, $url, $propagatedUrlParameters = null) {
$this->validators[] = new MoufBasicValidationProvider($name, $url, $propagatedUrlParameters);
} | php | public function registerBasicValidator($name, $url, $propagatedUrlParameters = null) {
$this->validators[] = new MoufBasicValidationProvider($name, $url, $propagatedUrlParameters);
} | [
"public",
"function",
"registerBasicValidator",
"(",
"$",
"name",
",",
"$",
"url",
",",
"$",
"propagatedUrlParameters",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"validators",
"[",
"]",
"=",
"new",
"MoufBasicValidationProvider",
"(",
"$",
"name",
",",
"$",
... | Registers dynamically a new validator.
@param string $name
@param string $url
@param array<string> $propagatedUrlParameters | [
"Registers",
"dynamically",
"a",
"new",
"validator",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Validator/MoufValidatorService.php#L100-L102 |
38,367 | thecodingmachine/mouf | src/Mouf/MoufGroupDescriptor.php | MoufGroupDescriptor.getJsonArray | public function getJsonArray() {
$array = array();
if (!empty($this->subGroups)) {
$array['subgroups'] = array();
foreach ($this->subGroups as $name => $subGroup) {
$array['subgroups'][$name] = $subGroup->getJsonArray();
}
}
if (!empty($this->packages)) {
$array['packages'] = array();
foreach ($this->packages as $name => $package) {
/* @var $package MoufPackageVersionsContainer */
$array['packages'][$name] = $package->getJsonArray();
}
}
return $array;
} | php | public function getJsonArray() {
$array = array();
if (!empty($this->subGroups)) {
$array['subgroups'] = array();
foreach ($this->subGroups as $name => $subGroup) {
$array['subgroups'][$name] = $subGroup->getJsonArray();
}
}
if (!empty($this->packages)) {
$array['packages'] = array();
foreach ($this->packages as $name => $package) {
/* @var $package MoufPackageVersionsContainer */
$array['packages'][$name] = $package->getJsonArray();
}
}
return $array;
} | [
"public",
"function",
"getJsonArray",
"(",
")",
"{",
"$",
"array",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"subGroups",
")",
")",
"{",
"$",
"array",
"[",
"'subgroups'",
"]",
"=",
"array",
"(",
")",
";",
"fore... | Returns a PHP array that describes the group.
The array does not contain all available information, only enough information to display the list of packages in the Mouf interface.
The structure of the array is:
array("subGroups" => array('subGroupName' => subGroupArray, 'packages' => array('packageName', packageArray)
return array | [
"Returns",
"a",
"PHP",
"array",
"that",
"describes",
"the",
"group",
".",
"The",
"array",
"does",
"not",
"contain",
"all",
"available",
"information",
"only",
"enough",
"information",
"to",
"display",
"the",
"list",
"of",
"packages",
"in",
"the",
"Mouf",
"in... | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufGroupDescriptor.php#L113-L129 |
38,368 | thecodingmachine/mouf | src-dev/Mouf/Controllers/MoufAjaxInstanceController.php | MoufAjaxInstanceController.index | public function index($name, $selfedit = false) {
$this->initController($name, $selfedit);
$this->template->getWebLibraryManager()->addLibrary(new WebLibrary(["vendor/mouf/javascript.ace/src-min-noconflict/ace.js"]));
$this->contentBlock->addFile(dirname(__FILE__)."/../../views/instances/viewInstance.php", $this);
$this->rightBlock->addText("<div id='instanceList'></div>");
$this->template->toHtml();
} | php | public function index($name, $selfedit = false) {
$this->initController($name, $selfedit);
$this->template->getWebLibraryManager()->addLibrary(new WebLibrary(["vendor/mouf/javascript.ace/src-min-noconflict/ace.js"]));
$this->contentBlock->addFile(dirname(__FILE__)."/../../views/instances/viewInstance.php", $this);
$this->rightBlock->addText("<div id='instanceList'></div>");
$this->template->toHtml();
} | [
"public",
"function",
"index",
"(",
"$",
"name",
",",
"$",
"selfedit",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"initController",
"(",
"$",
"name",
",",
"$",
"selfedit",
")",
";",
"$",
"this",
"->",
"template",
"->",
"getWebLibraryManager",
"(",
")",... | Displays the page to edit an instance.
@Action
@Logged
@param string $name the name of the component to display
@param string $selfedit If true, the name of the component must be a component from the Mouf framework itself (internal use only) | [
"Displays",
"the",
"page",
"to",
"edit",
"an",
"instance",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Controllers/MoufAjaxInstanceController.php#L37-L45 |
38,369 | thecodingmachine/mouf | src-dev/Mouf/Menu/ChooseInstanceMenuItem.php | ChooseInstanceMenuItem.getLink | public function getLink() {
$url = 'javascript:chooseInstancePopup('.json_encode($this->type).', "'.ROOT_URL.$this->getUrl().'?name=", "'.ROOT_URL.'")';
return $url;
} | php | public function getLink() {
$url = 'javascript:chooseInstancePopup('.json_encode($this->type).', "'.ROOT_URL.$this->getUrl().'?name=", "'.ROOT_URL.'")';
return $url;
} | [
"public",
"function",
"getLink",
"(",
")",
"{",
"$",
"url",
"=",
"'javascript:chooseInstancePopup('",
".",
"json_encode",
"(",
"$",
"this",
"->",
"type",
")",
".",
"', \"'",
".",
"ROOT_URL",
".",
"$",
"this",
"->",
"getUrl",
"(",
")",
".",
"'?name=\", \"'"... | Returns the URL for this menu. This URL is actually Javascript that will display the menu.
@return string | [
"Returns",
"the",
"URL",
"for",
"this",
"menu",
".",
"This",
"URL",
"is",
"actually",
"Javascript",
"that",
"will",
"display",
"the",
"menu",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Menu/ChooseInstanceMenuItem.php#L45-L48 |
38,370 | Lecturize/Laravel-Taxonomies | src/Traits/HasTaxonomies.php | HasTaxonomies.addTerm | public function addTerm($terms, $taxonomy, $parent = 0, $order = 0)
{
$terms = TaxableUtils::makeTermsArray($terms);
$this->createTaxables($terms, $taxonomy, $parent, $order);
$terms = Term::whereIn('name', $terms)->pluck('id')->all();
if (count($terms) > 0) {
foreach ($terms as $term) {
if ($this->taxonomies()->where('taxonomy', $taxonomy)->where('term_id', $term)->first())
continue;
$tax = Taxonomy::where('term_id', $term)->first();
$this->taxonomies()->attach($tax->id);
}
return;
}
$this->taxonomies()->detach();
} | php | public function addTerm($terms, $taxonomy, $parent = 0, $order = 0)
{
$terms = TaxableUtils::makeTermsArray($terms);
$this->createTaxables($terms, $taxonomy, $parent, $order);
$terms = Term::whereIn('name', $terms)->pluck('id')->all();
if (count($terms) > 0) {
foreach ($terms as $term) {
if ($this->taxonomies()->where('taxonomy', $taxonomy)->where('term_id', $term)->first())
continue;
$tax = Taxonomy::where('term_id', $term)->first();
$this->taxonomies()->attach($tax->id);
}
return;
}
$this->taxonomies()->detach();
} | [
"public",
"function",
"addTerm",
"(",
"$",
"terms",
",",
"$",
"taxonomy",
",",
"$",
"parent",
"=",
"0",
",",
"$",
"order",
"=",
"0",
")",
"{",
"$",
"terms",
"=",
"TaxableUtils",
"::",
"makeTermsArray",
"(",
"$",
"terms",
")",
";",
"$",
"this",
"->"... | Add one or multiple terms in a given taxonomy.
@param mixed $terms
@param string $taxonomy
@param integer $parent
@param integer $order | [
"Add",
"one",
"or",
"multiple",
"terms",
"in",
"a",
"given",
"taxonomy",
"."
] | 46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be | https://github.com/Lecturize/Laravel-Taxonomies/blob/46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be/src/Traits/HasTaxonomies.php#L42-L63 |
38,371 | Lecturize/Laravel-Taxonomies | src/Traits/HasTaxonomies.php | HasTaxonomies.getTerms | public function getTerms($taxonomy = '')
{
if ($taxonomy) {
$term_ids = $this->taxonomies->where('taxonomy', $taxonomy)->pluck('term_id');
} else {
$term_ids = $this->getTaxonomies('term_id');
}
return Term::whereIn('id', $term_ids)->get();
} | php | public function getTerms($taxonomy = '')
{
if ($taxonomy) {
$term_ids = $this->taxonomies->where('taxonomy', $taxonomy)->pluck('term_id');
} else {
$term_ids = $this->getTaxonomies('term_id');
}
return Term::whereIn('id', $term_ids)->get();
} | [
"public",
"function",
"getTerms",
"(",
"$",
"taxonomy",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"taxonomy",
")",
"{",
"$",
"term_ids",
"=",
"$",
"this",
"->",
"taxonomies",
"->",
"where",
"(",
"'taxonomy'",
",",
"$",
"taxonomy",
")",
"->",
"pluck",
"(",... | Get the terms related to a given taxonomy.
@param string $taxonomy
@return mixed | [
"Get",
"the",
"terms",
"related",
"to",
"a",
"given",
"taxonomy",
"."
] | 46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be | https://github.com/Lecturize/Laravel-Taxonomies/blob/46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be/src/Traits/HasTaxonomies.php#L122-L131 |
38,372 | Lecturize/Laravel-Taxonomies | src/Traits/HasTaxonomies.php | HasTaxonomies.getTerm | public function getTerm($term_name, $taxonomy = '')
{
if ($taxonomy) {
$term_ids = $this->taxonomies->where('taxonomy', $taxonomy)->pluck('term_id');
} else {
$term_ids = $this->getTaxonomies('term_id');
}
return Term::whereIn('id', $term_ids)->where('name', $term_name)->first();
} | php | public function getTerm($term_name, $taxonomy = '')
{
if ($taxonomy) {
$term_ids = $this->taxonomies->where('taxonomy', $taxonomy)->pluck('term_id');
} else {
$term_ids = $this->getTaxonomies('term_id');
}
return Term::whereIn('id', $term_ids)->where('name', $term_name)->first();
} | [
"public",
"function",
"getTerm",
"(",
"$",
"term_name",
",",
"$",
"taxonomy",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"taxonomy",
")",
"{",
"$",
"term_ids",
"=",
"$",
"this",
"->",
"taxonomies",
"->",
"where",
"(",
"'taxonomy'",
",",
"$",
"taxonomy",
")... | Get a term model by the given name and optionally a taxonomy.
@param string $term_name
@param string $taxonomy
@return mixed | [
"Get",
"a",
"term",
"model",
"by",
"the",
"given",
"name",
"and",
"optionally",
"a",
"taxonomy",
"."
] | 46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be | https://github.com/Lecturize/Laravel-Taxonomies/blob/46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be/src/Traits/HasTaxonomies.php#L140-L149 |
38,373 | Lecturize/Laravel-Taxonomies | src/Traits/HasTaxonomies.php | HasTaxonomies.removeTerm | public function removeTerm($term_name, $taxonomy = '')
{
if (! $term = $this->getTerm($term_name, $taxonomy))
return null;
if ($taxonomy) {
$taxonomy = $this->taxonomies->where('taxonomy', $taxonomy)->where('term_id', $term->id)->first();
} else {
$taxonomy = $this->taxonomies->where('term_id', $term->id)->first();
}
return $this->taxed()->where('taxonomy_id', $taxonomy->id)->delete();
} | php | public function removeTerm($term_name, $taxonomy = '')
{
if (! $term = $this->getTerm($term_name, $taxonomy))
return null;
if ($taxonomy) {
$taxonomy = $this->taxonomies->where('taxonomy', $taxonomy)->where('term_id', $term->id)->first();
} else {
$taxonomy = $this->taxonomies->where('term_id', $term->id)->first();
}
return $this->taxed()->where('taxonomy_id', $taxonomy->id)->delete();
} | [
"public",
"function",
"removeTerm",
"(",
"$",
"term_name",
",",
"$",
"taxonomy",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"term",
"=",
"$",
"this",
"->",
"getTerm",
"(",
"$",
"term_name",
",",
"$",
"taxonomy",
")",
")",
"return",
"null",
";",
"if"... | Disassociate the given term from this model.
@param string $term_name
@param string $taxonomy
@return mixed | [
"Disassociate",
"the",
"given",
"term",
"from",
"this",
"model",
"."
] | 46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be | https://github.com/Lecturize/Laravel-Taxonomies/blob/46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be/src/Traits/HasTaxonomies.php#L170-L182 |
38,374 | Lecturize/Laravel-Taxonomies | src/Traits/HasTaxonomies.php | HasTaxonomies.scopeWithTerms | public function scopeWithTerms($query, $terms, $taxonomy)
{
$terms = TaxableUtils::makeTermsArray($terms);
foreach ($terms as $term)
$this->scopeWithTerm($query, $term, $taxonomy);
return $query;
} | php | public function scopeWithTerms($query, $terms, $taxonomy)
{
$terms = TaxableUtils::makeTermsArray($terms);
foreach ($terms as $term)
$this->scopeWithTerm($query, $term, $taxonomy);
return $query;
} | [
"public",
"function",
"scopeWithTerms",
"(",
"$",
"query",
",",
"$",
"terms",
",",
"$",
"taxonomy",
")",
"{",
"$",
"terms",
"=",
"TaxableUtils",
"::",
"makeTermsArray",
"(",
"$",
"terms",
")",
";",
"foreach",
"(",
"$",
"terms",
"as",
"$",
"term",
")",
... | Scope by given terms.
@param object $query
@param array $terms
@param string $taxonomy
@return mixed | [
"Scope",
"by",
"given",
"terms",
"."
] | 46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be | https://github.com/Lecturize/Laravel-Taxonomies/blob/46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be/src/Traits/HasTaxonomies.php#L202-L210 |
38,375 | Lecturize/Laravel-Taxonomies | src/Traits/HasTaxonomies.php | HasTaxonomies.scopeWithTerm | public function scopeWithTerm($query, $term_name, $taxonomy)
{
$term_ids = Taxonomy::where('taxonomy', $taxonomy)->pluck('term_id');
$term = Term::whereIn('id', $term_ids)->where('name', $term_name)->first();
$taxonomy = Taxonomy::where('term_id', $term->id)->first();
return $query->whereHas('taxonomies', function($q) use($term, $taxonomy) {
$q->where('term_id', $term->id);
});
} | php | public function scopeWithTerm($query, $term_name, $taxonomy)
{
$term_ids = Taxonomy::where('taxonomy', $taxonomy)->pluck('term_id');
$term = Term::whereIn('id', $term_ids)->where('name', $term_name)->first();
$taxonomy = Taxonomy::where('term_id', $term->id)->first();
return $query->whereHas('taxonomies', function($q) use($term, $taxonomy) {
$q->where('term_id', $term->id);
});
} | [
"public",
"function",
"scopeWithTerm",
"(",
"$",
"query",
",",
"$",
"term_name",
",",
"$",
"taxonomy",
")",
"{",
"$",
"term_ids",
"=",
"Taxonomy",
"::",
"where",
"(",
"'taxonomy'",
",",
"$",
"taxonomy",
")",
"->",
"pluck",
"(",
"'term_id'",
")",
";",
"... | Scope by the given term.
@param object $query
@param string $term_name
@param string $taxonomy
@return mixed | [
"Scope",
"by",
"the",
"given",
"term",
"."
] | 46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be | https://github.com/Lecturize/Laravel-Taxonomies/blob/46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be/src/Traits/HasTaxonomies.php#L220-L230 |
38,376 | Lecturize/Laravel-Taxonomies | src/Traits/HasTaxonomies.php | HasTaxonomies.scopeHasCategory | public function scopeHasCategory($query, $taxonomy_id)
{
return $query->whereHas('taxed', function($q) use($taxonomy_id) {
$q->where('taxonomy_id', $taxonomy_id);
});
} | php | public function scopeHasCategory($query, $taxonomy_id)
{
return $query->whereHas('taxed', function($q) use($taxonomy_id) {
$q->where('taxonomy_id', $taxonomy_id);
});
} | [
"public",
"function",
"scopeHasCategory",
"(",
"$",
"query",
",",
"$",
"taxonomy_id",
")",
"{",
"return",
"$",
"query",
"->",
"whereHas",
"(",
"'taxed'",
",",
"function",
"(",
"$",
"q",
")",
"use",
"(",
"$",
"taxonomy_id",
")",
"{",
"$",
"q",
"->",
"... | Scope by category id.
@param object $query
@param integer $taxonomy_id
@return mixed | [
"Scope",
"by",
"category",
"id",
"."
] | 46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be | https://github.com/Lecturize/Laravel-Taxonomies/blob/46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be/src/Traits/HasTaxonomies.php#L259-L264 |
38,377 | Lecturize/Laravel-Taxonomies | src/Traits/HasTaxonomies.php | HasTaxonomies.scopeHasCategories | public function scopeHasCategories($query, $taxonomy_ids)
{
return $query->whereHas('taxed', function($q) use($taxonomy_ids) {
$q->whereIn('taxonomy_id', $taxonomy_ids);
});
} | php | public function scopeHasCategories($query, $taxonomy_ids)
{
return $query->whereHas('taxed', function($q) use($taxonomy_ids) {
$q->whereIn('taxonomy_id', $taxonomy_ids);
});
} | [
"public",
"function",
"scopeHasCategories",
"(",
"$",
"query",
",",
"$",
"taxonomy_ids",
")",
"{",
"return",
"$",
"query",
"->",
"whereHas",
"(",
"'taxed'",
",",
"function",
"(",
"$",
"q",
")",
"use",
"(",
"$",
"taxonomy_ids",
")",
"{",
"$",
"q",
"->",... | Scope by category ids.
@param object $query
@param array $taxonomy_ids
@return mixed | [
"Scope",
"by",
"category",
"ids",
"."
] | 46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be | https://github.com/Lecturize/Laravel-Taxonomies/blob/46774dbfef61131cf8f3fd9a2ab5c2ef4fccd6be/src/Traits/HasTaxonomies.php#L273-L278 |
38,378 | thecodingmachine/mouf | src-dev/Mouf/Controllers/IncludesAnalyzerController.php | IncludesAnalyzerController.refresh | public function refresh($selfedit = "false") {
$this->selfedit = $selfedit;
$moufCache = new MoufCache();
$moufCache->purgeAll();
header("Location: .?selfedit=".$selfedit);
} | php | public function refresh($selfedit = "false") {
$this->selfedit = $selfedit;
$moufCache = new MoufCache();
$moufCache->purgeAll();
header("Location: .?selfedit=".$selfedit);
} | [
"public",
"function",
"refresh",
"(",
"$",
"selfedit",
"=",
"\"false\"",
")",
"{",
"$",
"this",
"->",
"selfedit",
"=",
"$",
"selfedit",
";",
"$",
"moufCache",
"=",
"new",
"MoufCache",
"(",
")",
";",
"$",
"moufCache",
"->",
"purgeAll",
"(",
")",
";",
... | Purge cache and redirects to analysis page.
@Action
@Logged
@param string $selfedit | [
"Purge",
"cache",
"and",
"redirects",
"to",
"analysis",
"page",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Controllers/IncludesAnalyzerController.php#L134-L141 |
38,379 | thecodingmachine/mouf | src-dev/Mouf/Controllers/DocumentationController.php | DocumentationController.displayDocDirectory | public function displayDocDirectory($docPages, $packageName) {
?>
<ul>
<?php
foreach ($docPages as $docPage):
$url = $docPage['url'];
$title = $docPage['title'];
?>
<li>
<?php
if ($url) {
echo "<a href='view/".$packageName."/".$url."'>";
}
echo $title;
if ($url) {
echo "</a>";
}
/*if ($docPage->getChildren()) {
displayDocDirectory($docPage->getChildren());
}*/
?>
</li>
<?php
endforeach;
?>
</ul>
<?php
} | php | public function displayDocDirectory($docPages, $packageName) {
?>
<ul>
<?php
foreach ($docPages as $docPage):
$url = $docPage['url'];
$title = $docPage['title'];
?>
<li>
<?php
if ($url) {
echo "<a href='view/".$packageName."/".$url."'>";
}
echo $title;
if ($url) {
echo "</a>";
}
/*if ($docPage->getChildren()) {
displayDocDirectory($docPage->getChildren());
}*/
?>
</li>
<?php
endforeach;
?>
</ul>
<?php
} | [
"public",
"function",
"displayDocDirectory",
"(",
"$",
"docPages",
",",
"$",
"packageName",
")",
"{",
"?>\r\n<ul>\r\n\t\t<?php",
"foreach",
"(",
"$",
"docPages",
"as",
"$",
"docPage",
")",
":",
"$",
"url",
"=",
"$",
"docPage",
"[",
"'url'",
"]",
";",
"$",
... | Display the doc links for one package.
@param array<string, string> $docPages
@param string $packageName | [
"Display",
"the",
"doc",
"links",
"for",
"one",
"package",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Controllers/DocumentationController.php#L348-L375 |
38,380 | thecodingmachine/mouf | src-dev/Mouf/Installer/ComposerInstaller.php | ComposerInstaller.save | public function save() {
if ($this->installTasks === null) {
return;
}
// Let's grab all install tasks and save them according to their scope.
// If no scope is provided, we default to global scope.
$localInstalls = array();
$globalInstalls = array();
foreach ($this->installTasks as $task) {
switch ($task->getScope()) {
case AbstractInstallTask::SCOPE_GLOBAL:
case '':
$globalInstalls[] = $task->toArray();
break;
case AbstractInstallTask::SCOPE_LOCAL:
$localInstalls[] = $task->toArray();
break;
default:
throw new MoufException("Unknown install task scope '".$task->getScope()."'.");
}
}
$this->ensureWritable($this->globalInstallFile);
$this->ensureWritable($this->localInstallFile);
$fp = fopen($this->globalInstallFile, "w");
fwrite($fp, "<?php\n");
fwrite($fp, "/**\n");
fwrite($fp, " * This is a file automatically generated by the Mouf framework. Do not modify it, as it could be overwritten.\n");
fwrite($fp, " * This file contains the status of all Mouf global installation processes for packages you have installed.\n");
fwrite($fp, " * If you are working with a source repository, this file should be commited.\n");
fwrite($fp, " */\n");
fwrite($fp, "return ".var_export($globalInstalls, true).";");
fclose($fp);
$fp = fopen($this->localInstallFile, "w");
fwrite($fp, "<?php\n");
fwrite($fp, "/**\n");
fwrite($fp, " * This is a file automatically generated by the Mouf framework. Do not modify it, as it could be overwritten.\n");
fwrite($fp, " * This file contains the status of all Mouf local installation processes for packages you have installed.\n");
fwrite($fp, " * If you are working with a source repository, this file should NOT be commited.\n");
fwrite($fp, " */\n");
fwrite($fp, "return ".var_export($localInstalls, true).";");
fclose($fp);
@chmod($this->globalInstallFile, 0664);
@chmod($this->localInstallFile, 0664);
if (function_exists("opcache_invalidate")) {
opcache_invalidate($this->globalInstallFile);
opcache_invalidate($this->localInstallFile);
}
} | php | public function save() {
if ($this->installTasks === null) {
return;
}
// Let's grab all install tasks and save them according to their scope.
// If no scope is provided, we default to global scope.
$localInstalls = array();
$globalInstalls = array();
foreach ($this->installTasks as $task) {
switch ($task->getScope()) {
case AbstractInstallTask::SCOPE_GLOBAL:
case '':
$globalInstalls[] = $task->toArray();
break;
case AbstractInstallTask::SCOPE_LOCAL:
$localInstalls[] = $task->toArray();
break;
default:
throw new MoufException("Unknown install task scope '".$task->getScope()."'.");
}
}
$this->ensureWritable($this->globalInstallFile);
$this->ensureWritable($this->localInstallFile);
$fp = fopen($this->globalInstallFile, "w");
fwrite($fp, "<?php\n");
fwrite($fp, "/**\n");
fwrite($fp, " * This is a file automatically generated by the Mouf framework. Do not modify it, as it could be overwritten.\n");
fwrite($fp, " * This file contains the status of all Mouf global installation processes for packages you have installed.\n");
fwrite($fp, " * If you are working with a source repository, this file should be commited.\n");
fwrite($fp, " */\n");
fwrite($fp, "return ".var_export($globalInstalls, true).";");
fclose($fp);
$fp = fopen($this->localInstallFile, "w");
fwrite($fp, "<?php\n");
fwrite($fp, "/**\n");
fwrite($fp, " * This is a file automatically generated by the Mouf framework. Do not modify it, as it could be overwritten.\n");
fwrite($fp, " * This file contains the status of all Mouf local installation processes for packages you have installed.\n");
fwrite($fp, " * If you are working with a source repository, this file should NOT be commited.\n");
fwrite($fp, " */\n");
fwrite($fp, "return ".var_export($localInstalls, true).";");
fclose($fp);
@chmod($this->globalInstallFile, 0664);
@chmod($this->localInstallFile, 0664);
if (function_exists("opcache_invalidate")) {
opcache_invalidate($this->globalInstallFile);
opcache_invalidate($this->localInstallFile);
}
} | [
"public",
"function",
"save",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"installTasks",
"===",
"null",
")",
"{",
"return",
";",
"}",
"// Let's grab all install tasks and save them according to their scope.",
"// If no scope is provided, we default to global scope.",
"$",... | Saves any modified install task. | [
"Saves",
"any",
"modified",
"install",
"task",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Installer/ComposerInstaller.php#L67-L121 |
38,381 | thecodingmachine/mouf | src-dev/Mouf/Installer/ComposerInstaller.php | ComposerInstaller.completeStatusFromInstallFile | private function completeStatusFromInstallFile(array $installStatuses) {
foreach ($this->installTasks as $installTask) {
/* @var $installTask AbstractInstallTask */
foreach ($installStatuses as $installStatus) {
if ($installTask->matchesPackage($installStatus)) {
$installTask->setStatus($installStatus['status']);
}
}
}
} | php | private function completeStatusFromInstallFile(array $installStatuses) {
foreach ($this->installTasks as $installTask) {
/* @var $installTask AbstractInstallTask */
foreach ($installStatuses as $installStatus) {
if ($installTask->matchesPackage($installStatus)) {
$installTask->setStatus($installStatus['status']);
}
}
}
} | [
"private",
"function",
"completeStatusFromInstallFile",
"(",
"array",
"$",
"installStatuses",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"installTasks",
"as",
"$",
"installTask",
")",
"{",
"/* @var $installTask AbstractInstallTask */",
"foreach",
"(",
"$",
"installS... | Takes in input the array contained in an install file and completes the status of the
install tasks from here.
@param array $installStatuses | [
"Takes",
"in",
"input",
"the",
"array",
"contained",
"in",
"an",
"install",
"file",
"and",
"completes",
"the",
"status",
"of",
"the",
"install",
"tasks",
"from",
"here",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Installer/ComposerInstaller.php#L208-L217 |
38,382 | thecodingmachine/mouf | src-dev/Mouf/Installer/ComposerInstaller.php | ComposerInstaller.install | public function install(array $task) {
// The kind of action to be performed is stored in a file (mouf/installActions.json)
// This file contains an array that can be either:
// { "type": "all" } => install all tasks marked "todo"
// { "type": "one", "task": { // task details } } => install only the task passed in parameter
self::ensureWritable($this->installStatusFile);
file_put_contents($this->installStatusFile, json_encode(
array("type"=>"one",
"task"=>$task)));
header("Location: ".MOUF_URL."installer/printInstallationScreen?selfedit=".json_encode($this->selfEdit));
} | php | public function install(array $task) {
// The kind of action to be performed is stored in a file (mouf/installActions.json)
// This file contains an array that can be either:
// { "type": "all" } => install all tasks marked "todo"
// { "type": "one", "task": { // task details } } => install only the task passed in parameter
self::ensureWritable($this->installStatusFile);
file_put_contents($this->installStatusFile, json_encode(
array("type"=>"one",
"task"=>$task)));
header("Location: ".MOUF_URL."installer/printInstallationScreen?selfedit=".json_encode($this->selfEdit));
} | [
"public",
"function",
"install",
"(",
"array",
"$",
"task",
")",
"{",
"// The kind of action to be performed is stored in a file (mouf/installActions.json)",
"// This file contains an array that can be either:",
"// { \"type\": \"all\" } => install all tasks marked \"todo\"",
"// { \"type\":... | Starts the install process for only only task.
@param array $task | [
"Starts",
"the",
"install",
"process",
"for",
"only",
"only",
"task",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Installer/ComposerInstaller.php#L274-L285 |
38,383 | thecodingmachine/mouf | src-dev/Mouf/Installer/ComposerInstaller.php | ComposerInstaller.findInstallTaskFromArray | private function findInstallTaskFromArray(array $array) {
$installTasks = $this->getInstallTasks();
foreach ($installTasks as $installTask) {
if ($installTask->matchesPackage($array)) {
return $installTask;
}
}
throw new MoufException("Unable to find install task in matching array passed in parameter.");
} | php | private function findInstallTaskFromArray(array $array) {
$installTasks = $this->getInstallTasks();
foreach ($installTasks as $installTask) {
if ($installTask->matchesPackage($array)) {
return $installTask;
}
}
throw new MoufException("Unable to find install task in matching array passed in parameter.");
} | [
"private",
"function",
"findInstallTaskFromArray",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"installTasks",
"=",
"$",
"this",
"->",
"getInstallTasks",
"(",
")",
";",
"foreach",
"(",
"$",
"installTasks",
"as",
"$",
"installTask",
")",
"{",
"if",
"(",
"$",... | Finds the InstallTask from the array representing it.
@param array $array
@return AbstractInstallTask | [
"Finds",
"the",
"InstallTask",
"from",
"the",
"array",
"representing",
"it",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Installer/ComposerInstaller.php#L303-L312 |
38,384 | thecodingmachine/mouf | src-dev/Mouf/Installer/ComposerInstaller.php | ComposerInstaller.validateCurrentInstall | public function validateCurrentInstall() {
if (!file_exists($this->installStatusFile)) {
throw new MoufException("No install status file found. I don't know what install task should be run.");
}
$statusArray = json_decode(file_get_contents($this->installStatusFile), true);
if ($statusArray['type'] == 'one') {
$taskArray = $statusArray['task'];
// Now, let's find the matching task and mark it "done".
$installTask = $this->findInstallTaskFromArray($taskArray);
$installTask->setStatus(AbstractInstallTask::STATUS_DONE);
$this->save();
// Finally, let's delete the install status file.
unlink($this->installStatusFile);
} else {
$installTasks = $this->getInstallTasks();
foreach ($installTasks as $installTask) {
if ($installTask->getStatus() == AbstractInstallTask::STATUS_TODO) {
$installTask->setStatus(AbstractInstallTask::STATUS_DONE);
$this->save();
break;
}
}
$todoRemaining = false;
foreach ($installTasks as $installTask) {
if ($installTask->getStatus() == AbstractInstallTask::STATUS_TODO) {
$todoRemaining = true;
break;
}
}
if (!$todoRemaining) {
// Finally, let's delete the install status file if there are no actions in "todo" state
unlink($this->installStatusFile);
}
}
} | php | public function validateCurrentInstall() {
if (!file_exists($this->installStatusFile)) {
throw new MoufException("No install status file found. I don't know what install task should be run.");
}
$statusArray = json_decode(file_get_contents($this->installStatusFile), true);
if ($statusArray['type'] == 'one') {
$taskArray = $statusArray['task'];
// Now, let's find the matching task and mark it "done".
$installTask = $this->findInstallTaskFromArray($taskArray);
$installTask->setStatus(AbstractInstallTask::STATUS_DONE);
$this->save();
// Finally, let's delete the install status file.
unlink($this->installStatusFile);
} else {
$installTasks = $this->getInstallTasks();
foreach ($installTasks as $installTask) {
if ($installTask->getStatus() == AbstractInstallTask::STATUS_TODO) {
$installTask->setStatus(AbstractInstallTask::STATUS_DONE);
$this->save();
break;
}
}
$todoRemaining = false;
foreach ($installTasks as $installTask) {
if ($installTask->getStatus() == AbstractInstallTask::STATUS_TODO) {
$todoRemaining = true;
break;
}
}
if (!$todoRemaining) {
// Finally, let's delete the install status file if there are no actions in "todo" state
unlink($this->installStatusFile);
}
}
} | [
"public",
"function",
"validateCurrentInstall",
"(",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"installStatusFile",
")",
")",
"{",
"throw",
"new",
"MoufException",
"(",
"\"No install status file found. I don't know what install task should be run.\"... | Marks the current install task as "done". | [
"Marks",
"the",
"current",
"install",
"task",
"as",
"done",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src-dev/Mouf/Installer/ComposerInstaller.php#L346-L383 |
38,385 | thecodingmachine/mouf | src/Mouf/Reflection/MoufAnnotationHelper.php | MoufAnnotationHelper.getValueAsList | public static function getValueAsList($value) {
$tokens = token_get_all('<?php '.$value);
$resultArray = array();
// Le's find all the strings, and let's put each string in the table.
foreach ($tokens as $token) {
if ($token[0] == T_CONSTANT_ENCAPSED_STRING) {
$resultArray[] = substr($token[1], 1, strlen($token[1])-2) ;
}
}
return $resultArray;
} | php | public static function getValueAsList($value) {
$tokens = token_get_all('<?php '.$value);
$resultArray = array();
// Le's find all the strings, and let's put each string in the table.
foreach ($tokens as $token) {
if ($token[0] == T_CONSTANT_ENCAPSED_STRING) {
$resultArray[] = substr($token[1], 1, strlen($token[1])-2) ;
}
}
return $resultArray;
} | [
"public",
"static",
"function",
"getValueAsList",
"(",
"$",
"value",
")",
"{",
"$",
"tokens",
"=",
"token_get_all",
"(",
"'<?php '",
".",
"$",
"value",
")",
";",
"$",
"resultArray",
"=",
"array",
"(",
")",
";",
"// Le's find all the strings, and let's put each s... | Returns a list from the string. The string can be specified as "toto", "tata", "titi"
@param string $value
@return array<string> | [
"Returns",
"a",
"list",
"from",
"the",
"string",
".",
"The",
"string",
"can",
"be",
"specified",
"as",
"toto",
"tata",
"titi"
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufAnnotationHelper.php#L24-L37 |
38,386 | thecodingmachine/mouf | src/Mouf/MoufPropertyDescriptor.php | MoufPropertyDescriptor.getPropertyNameFromSetterName | public static function getPropertyNameFromSetterName($methodName) {
if (strpos($methodName, "set") !== 0) {
throw new MoufException("Error while creating MoufPropertyDescriptor. A @Property annotation must be set to methods that start with 'set'. For instance: setName, and setPhone are valid @Property setters. $methodName is not a valid setter name.");
}
$propName1 = substr($methodName, 3);
if (empty($propName1)) {
throw new MoufException("Error while creating MoufPropertyDescriptor. A @Property annotation cannot be put on a method named 'set'. It must be put on a method whose name starts with 'set'. For instance: setName, and setPhone are valid @Property setters.");
}
$propName2 = strtolower(substr($propName1,0,1)).substr($propName1,1);
return $propName2;
} | php | public static function getPropertyNameFromSetterName($methodName) {
if (strpos($methodName, "set") !== 0) {
throw new MoufException("Error while creating MoufPropertyDescriptor. A @Property annotation must be set to methods that start with 'set'. For instance: setName, and setPhone are valid @Property setters. $methodName is not a valid setter name.");
}
$propName1 = substr($methodName, 3);
if (empty($propName1)) {
throw new MoufException("Error while creating MoufPropertyDescriptor. A @Property annotation cannot be put on a method named 'set'. It must be put on a method whose name starts with 'set'. For instance: setName, and setPhone are valid @Property setters.");
}
$propName2 = strtolower(substr($propName1,0,1)).substr($propName1,1);
return $propName2;
} | [
"public",
"static",
"function",
"getPropertyNameFromSetterName",
"(",
"$",
"methodName",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"methodName",
",",
"\"set\"",
")",
"!==",
"0",
")",
"{",
"throw",
"new",
"MoufException",
"(",
"\"Error while creating MoufPropertyDes... | Transforms the setter name in a property name.
For instance, getPhone => phone or getName => name
@param string $methodName
@return string | [
"Transforms",
"the",
"setter",
"name",
"in",
"a",
"property",
"name",
".",
"For",
"instance",
"getPhone",
"=",
">",
"phone",
"or",
"getName",
"=",
">",
"name"
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufPropertyDescriptor.php#L290-L300 |
38,387 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionMethod.php | MoufReflectionMethod.getDeclaringClass | public function getDeclaringClass()
{
if ($this->declaringClass) {
return $this->declaringClass;
}
$methodFile = $this->getFileName();
$methodStartLine = $this->getStartLine();
$methodEndLine = $this->getEndLine();
$oldDeclaringClass = $this->getDeclaringClassWithoutTraits();
// Let's scan all traits
$trait = $this->deepScanTraits($oldDeclaringClass->getTraits(), $methodFile, $methodStartLine, $methodEndLine);
if ($trait != null) {
$this->declaringClass = $trait;
return $trait;
} else {
$this->declaringClass = $oldDeclaringClass;
return $oldDeclaringClass;
}
} | php | public function getDeclaringClass()
{
if ($this->declaringClass) {
return $this->declaringClass;
}
$methodFile = $this->getFileName();
$methodStartLine = $this->getStartLine();
$methodEndLine = $this->getEndLine();
$oldDeclaringClass = $this->getDeclaringClassWithoutTraits();
// Let's scan all traits
$trait = $this->deepScanTraits($oldDeclaringClass->getTraits(), $methodFile, $methodStartLine, $methodEndLine);
if ($trait != null) {
$this->declaringClass = $trait;
return $trait;
} else {
$this->declaringClass = $oldDeclaringClass;
return $oldDeclaringClass;
}
} | [
"public",
"function",
"getDeclaringClass",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"declaringClass",
")",
"{",
"return",
"$",
"this",
"->",
"declaringClass",
";",
"}",
"$",
"methodFile",
"=",
"$",
"this",
"->",
"getFileName",
"(",
")",
";",
"$",
"... | returns the class that declares this method
@return MoufReflectionClass | [
"returns",
"the",
"class",
"that",
"declares",
"this",
"method"
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionMethod.php#L154-L175 |
38,388 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionMethod.php | MoufReflectionMethod.toXml | public function toXml(\SimpleXmlElement $root) {
$methodNode = $root->addChild("method");
$methodNode->addAttribute("name", $this->getName());
$modifier = "";
if ($this->isPublic()) {
$modifier = "public";
} elseif ($this->isProtected()) {
$modifier = "protected";
} elseif ($this->isPrivate()) {
$modifier = "private";
}
$methodNode->addAttribute("modifier", $modifier);
$methodNode->addAttribute("static", $this->isStatic()?"true":"false");
$methodNode->addAttribute("abstract", $this->isAbstract()?"true":"false");
$methodNode->addAttribute("constructor", $this->isConstructor()?"true":"false");
$methodNode->addAttribute("final", $this->isFinal()?"true":"false");
$commentNode = $methodNode->addChild("comment");
$node= dom_import_simplexml($commentNode);
$no = $node->ownerDocument;
$node->appendChild($no->createCDATASection($this->getDocComment()));
foreach ($this->getParameters() as $parameter) {
$parameter->toXml($methodNode);
}
} | php | public function toXml(\SimpleXmlElement $root) {
$methodNode = $root->addChild("method");
$methodNode->addAttribute("name", $this->getName());
$modifier = "";
if ($this->isPublic()) {
$modifier = "public";
} elseif ($this->isProtected()) {
$modifier = "protected";
} elseif ($this->isPrivate()) {
$modifier = "private";
}
$methodNode->addAttribute("modifier", $modifier);
$methodNode->addAttribute("static", $this->isStatic()?"true":"false");
$methodNode->addAttribute("abstract", $this->isAbstract()?"true":"false");
$methodNode->addAttribute("constructor", $this->isConstructor()?"true":"false");
$methodNode->addAttribute("final", $this->isFinal()?"true":"false");
$commentNode = $methodNode->addChild("comment");
$node= dom_import_simplexml($commentNode);
$no = $node->ownerDocument;
$node->appendChild($no->createCDATASection($this->getDocComment()));
foreach ($this->getParameters() as $parameter) {
$parameter->toXml($methodNode);
}
} | [
"public",
"function",
"toXml",
"(",
"\\",
"SimpleXmlElement",
"$",
"root",
")",
"{",
"$",
"methodNode",
"=",
"$",
"root",
"->",
"addChild",
"(",
"\"method\"",
")",
";",
"$",
"methodNode",
"->",
"addAttribute",
"(",
"\"name\"",
",",
"$",
"this",
"->",
"ge... | Appends this method to the XML node passed in parameter.
@param SimpleXmlElement $root The root XML node the method will be appended to. | [
"Appends",
"this",
"method",
"to",
"the",
"XML",
"node",
"passed",
"in",
"parameter",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionMethod.php#L251-L277 |
38,389 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionMethod.php | MoufReflectionMethod.toJson | public function toJson() {
$result = array();
$result['name'] = $this->getName();
$modifier = "";
if ($this->isPublic()) {
$modifier = "public";
} elseif ($this->isProtected()) {
$modifier = "protected";
} elseif ($this->isPrivate()) {
$modifier = "private";
}
$result['modifier'] = $modifier;
$result['static'] = $this->isStatic();
$result['abstract'] = $this->isAbstract();
$result['constructor'] = $this->isConstructor();
$result['final'] = $this->isFinal();
//$result['comment'] = $this->getDocComment();
$result['comment'] = $this->getMoufPhpDocComment()->getJsonArray();
$result['parameters'] = array();
$parameters = $this->getParameters();
foreach ($parameters as $parameter) {
$result['parameters'][] = $parameter->toJson();
}
//$properties = $this->getAnnotations("Property");
try {
/*if (!empty($properties)) {
$result['moufProperty'] = true;*/
// TODO: is there a need to instanciate a MoufPropertyDescriptor?
// If this is a setter only:
if ($this->isSetter()) {
$moufPropertyDescriptor = new MoufPropertyDescriptor($this);
$types = $moufPropertyDescriptor->getTypes();
$result['types'] = $types->toJson();
if ($types->getWarningMessage()) {
$result['classinerror'] = $types->getWarningMessage();
}
}
/*if ($moufPropertyDescriptor->isAssociativeArray()) {
$result['keytype'] = $moufPropertyDescriptor->getKeyType();
}
if ($moufPropertyDescriptor->isArray()) {
$result['subtype'] = $moufPropertyDescriptor->getSubType();
}*/
//}
} catch (\Exception $e) {
$result['classinerror'] = $e->getMessage();
}
return $result;
} | php | public function toJson() {
$result = array();
$result['name'] = $this->getName();
$modifier = "";
if ($this->isPublic()) {
$modifier = "public";
} elseif ($this->isProtected()) {
$modifier = "protected";
} elseif ($this->isPrivate()) {
$modifier = "private";
}
$result['modifier'] = $modifier;
$result['static'] = $this->isStatic();
$result['abstract'] = $this->isAbstract();
$result['constructor'] = $this->isConstructor();
$result['final'] = $this->isFinal();
//$result['comment'] = $this->getDocComment();
$result['comment'] = $this->getMoufPhpDocComment()->getJsonArray();
$result['parameters'] = array();
$parameters = $this->getParameters();
foreach ($parameters as $parameter) {
$result['parameters'][] = $parameter->toJson();
}
//$properties = $this->getAnnotations("Property");
try {
/*if (!empty($properties)) {
$result['moufProperty'] = true;*/
// TODO: is there a need to instanciate a MoufPropertyDescriptor?
// If this is a setter only:
if ($this->isSetter()) {
$moufPropertyDescriptor = new MoufPropertyDescriptor($this);
$types = $moufPropertyDescriptor->getTypes();
$result['types'] = $types->toJson();
if ($types->getWarningMessage()) {
$result['classinerror'] = $types->getWarningMessage();
}
}
/*if ($moufPropertyDescriptor->isAssociativeArray()) {
$result['keytype'] = $moufPropertyDescriptor->getKeyType();
}
if ($moufPropertyDescriptor->isArray()) {
$result['subtype'] = $moufPropertyDescriptor->getSubType();
}*/
//}
} catch (\Exception $e) {
$result['classinerror'] = $e->getMessage();
}
return $result;
} | [
"public",
"function",
"toJson",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"result",
"[",
"'name'",
"]",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"$",
"modifier",
"=",
"\"\"",
";",
"if",
"(",
"$",
"this",
"->",
"is... | Returns a PHP array representing the method.
@return array | [
"Returns",
"a",
"PHP",
"array",
"representing",
"the",
"method",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionMethod.php#L284-L342 |
38,390 | thecodingmachine/mouf | src/Mouf/Reflection/MoufReflectionMethod.php | MoufReflectionMethod.isSetter | public function isSetter() {
$methodName = $this->getName();
if (strpos($methodName, "set") === 0 && strlen($methodName)>3) {
// A setter must have exactly one compulsory parameter
$parameters = $this->getParameters();
if (count($parameters) == 0) {
return false;
}
if (count($parameters)>1) {
for ($i=1, $count=count($parameters); $i<$count; $i++) {
$param = $parameters[$i];
if (!$param->isDefaultValueAvailable()) {
return false;
}
}
}
return true;
}
return false;
} | php | public function isSetter() {
$methodName = $this->getName();
if (strpos($methodName, "set") === 0 && strlen($methodName)>3) {
// A setter must have exactly one compulsory parameter
$parameters = $this->getParameters();
if (count($parameters) == 0) {
return false;
}
if (count($parameters)>1) {
for ($i=1, $count=count($parameters); $i<$count; $i++) {
$param = $parameters[$i];
if (!$param->isDefaultValueAvailable()) {
return false;
}
}
}
return true;
}
return false;
} | [
"public",
"function",
"isSetter",
"(",
")",
"{",
"$",
"methodName",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"methodName",
",",
"\"set\"",
")",
"===",
"0",
"&&",
"strlen",
"(",
"$",
"methodName",
")",
">",
"3... | Returns true if this method has the signature of a setter.
@return boolean | [
"Returns",
"true",
"if",
"this",
"method",
"has",
"the",
"signature",
"of",
"a",
"setter",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Reflection/MoufReflectionMethod.php#L349-L371 |
38,391 | thecodingmachine/mouf | src/Mouf/CodeValidatorService.php | CodeValidatorService.validateCode | public static function validateCode($codeString) {
$code = "<?php \$a = function(ContainerInterface \$container) { ".$codeString."\n}\n?>";
$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
$stmts = $parser->parse($code);
// If we are here, the code is correct.
// Let's add a last check: whether there is a "return" keyword or not.
if (stripos($code, "return") === false) {
throw new Error("Missing 'return' keyword.", count(explode("\n", $codeString)));
}
} | php | public static function validateCode($codeString) {
$code = "<?php \$a = function(ContainerInterface \$container) { ".$codeString."\n}\n?>";
$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
$stmts = $parser->parse($code);
// If we are here, the code is correct.
// Let's add a last check: whether there is a "return" keyword or not.
if (stripos($code, "return") === false) {
throw new Error("Missing 'return' keyword.", count(explode("\n", $codeString)));
}
} | [
"public",
"static",
"function",
"validateCode",
"(",
"$",
"codeString",
")",
"{",
"$",
"code",
"=",
"\"<?php \\$a = function(ContainerInterface \\$container) { \"",
".",
"$",
"codeString",
".",
"\"\\n}\\n?>\"",
";",
"$",
"parser",
"=",
"(",
"new",
"ParserFactory",
"... | This function will throw a PhpParser\Error exception if a parsing error is met in the code.
@param string $codeString
@throws \PhpParser\Error | [
"This",
"function",
"will",
"throw",
"a",
"PhpParser",
"\\",
"Error",
"exception",
"if",
"a",
"parsing",
"error",
"is",
"met",
"in",
"the",
"code",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/CodeValidatorService.php#L32-L44 |
38,392 | thecodingmachine/mouf | src/Mouf/Moufspector.php | Moufspector.getComponentsList | public static function getComponentsList($type = null, $selfEdit = false) {
//$composerService = new ComposerService($selfEdit);
$moufClassExplorer = new MoufClassExplorer($selfEdit);
$classesList = array_keys($moufClassExplorer->getClassMap());
// Let's add the list of PHP inner classes.
$innerClasses = get_declared_classes();
$classesList = array_merge($classesList, $innerClasses);
$classesList = array_flip(array_flip($classesList));
//$classesList = get_declared_classes();
$componentsList = array();
foreach ($classesList as $className) {
$refClass = new MoufReflectionClass($className);
if ($refClass->isInstantiable()) {
if ($type == null) {
$componentsList[] = $className;
} else {
try {
if ($refClass->implementsInterface($type)) {
$componentsList[] = $className;
continue;
}
} catch (\ReflectionException $e) {
// The interface might not exist, that's not a problem
}
try {
if ($refClass->isSubclassOf($type)) {
$componentsList[] = $className;
continue;
}
} catch (\ReflectionException $e) {
// The class might not exist, that's not a problem
}
if ($refClass->getName() == $type) {
$componentsList[] = $className;
}
}
}
}
return $componentsList;
} | php | public static function getComponentsList($type = null, $selfEdit = false) {
//$composerService = new ComposerService($selfEdit);
$moufClassExplorer = new MoufClassExplorer($selfEdit);
$classesList = array_keys($moufClassExplorer->getClassMap());
// Let's add the list of PHP inner classes.
$innerClasses = get_declared_classes();
$classesList = array_merge($classesList, $innerClasses);
$classesList = array_flip(array_flip($classesList));
//$classesList = get_declared_classes();
$componentsList = array();
foreach ($classesList as $className) {
$refClass = new MoufReflectionClass($className);
if ($refClass->isInstantiable()) {
if ($type == null) {
$componentsList[] = $className;
} else {
try {
if ($refClass->implementsInterface($type)) {
$componentsList[] = $className;
continue;
}
} catch (\ReflectionException $e) {
// The interface might not exist, that's not a problem
}
try {
if ($refClass->isSubclassOf($type)) {
$componentsList[] = $className;
continue;
}
} catch (\ReflectionException $e) {
// The class might not exist, that's not a problem
}
if ($refClass->getName() == $type) {
$componentsList[] = $className;
}
}
}
}
return $componentsList;
} | [
"public",
"static",
"function",
"getComponentsList",
"(",
"$",
"type",
"=",
"null",
",",
"$",
"selfEdit",
"=",
"false",
")",
"{",
"//$composerService = new ComposerService($selfEdit);\r",
"$",
"moufClassExplorer",
"=",
"new",
"MoufClassExplorer",
"(",
"$",
"selfEdit",... | Returns a list of all the classes, or only classes inheriting the passed
class or interface. Classes that can't be instanciated are excluded from the list.
@type string the class or interface the class must inherit to be part of the list. If not passed, all classes are returned.
@return array<string> | [
"Returns",
"a",
"list",
"of",
"all",
"the",
"classes",
"or",
"only",
"classes",
"inheriting",
"the",
"passed",
"class",
"or",
"interface",
".",
"Classes",
"that",
"can",
"t",
"be",
"instanciated",
"are",
"excluded",
"from",
"the",
"list",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/Moufspector.php#L31-L75 |
38,393 | thecodingmachine/mouf | src/Mouf/MoufClassExplorer.php | MoufClassExplorer.getClassMap | public function getClassMap() {
if ($this->classMap) {
return $this->classMap;
}
if ($this->useCache) {
// Cache duration: 30 minutes.
$this->classMap = $this->cacheService->get("mouf.classMap.".__DIR__."/".json_encode($this->selfEdit));
if ($this->classMap != null) {
return $this->classMap;
}
}
$this->analyze();
return $this->classMap;
} | php | public function getClassMap() {
if ($this->classMap) {
return $this->classMap;
}
if ($this->useCache) {
// Cache duration: 30 minutes.
$this->classMap = $this->cacheService->get("mouf.classMap.".__DIR__."/".json_encode($this->selfEdit));
if ($this->classMap != null) {
return $this->classMap;
}
}
$this->analyze();
return $this->classMap;
} | [
"public",
"function",
"getClassMap",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"classMap",
")",
"{",
"return",
"$",
"this",
"->",
"classMap",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"useCache",
")",
"{",
"// Cache duration: 30 minutes.\r",
"$",
"this"... | Returns the classmap of all available and safe to include classes.
@return array<string, string> | [
"Returns",
"the",
"classmap",
"of",
"all",
"available",
"and",
"safe",
"to",
"include",
"classes",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufClassExplorer.php#L231-L246 |
38,394 | thecodingmachine/mouf | src/Mouf/MoufClassExplorer.php | MoufClassExplorer.getErrors | public function getErrors() {
if ($this->forbiddenClasses) {
return $this->forbiddenClasses;
}
if ($this->useCache) {
// Cache duration: 30 minutes.
$this->forbiddenClasses = $this->cacheService->get("forbidden.classes.".__DIR__."/".json_encode($this->selfEdit));
if ($this->forbiddenClasses != null) {
return $this->forbiddenClasses;
}
}
$this->analyze();
return $this->forbiddenClasses;
} | php | public function getErrors() {
if ($this->forbiddenClasses) {
return $this->forbiddenClasses;
}
if ($this->useCache) {
// Cache duration: 30 minutes.
$this->forbiddenClasses = $this->cacheService->get("forbidden.classes.".__DIR__."/".json_encode($this->selfEdit));
if ($this->forbiddenClasses != null) {
return $this->forbiddenClasses;
}
}
$this->analyze();
return $this->forbiddenClasses;
} | [
"public",
"function",
"getErrors",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"forbiddenClasses",
")",
"{",
"return",
"$",
"this",
"->",
"forbiddenClasses",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"useCache",
")",
"{",
"// Cache duration: 30 minutes.\r",
... | Returns the array of all classes that have problems to be included, along the error associated.
The key is the filename, the value the error message outputed.
@return array<string, string> | [
"Returns",
"the",
"array",
"of",
"all",
"classes",
"that",
"have",
"problems",
"to",
"be",
"included",
"along",
"the",
"error",
"associated",
".",
"The",
"key",
"is",
"the",
"filename",
"the",
"value",
"the",
"error",
"message",
"outputed",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufClassExplorer.php#L253-L268 |
38,395 | thecodingmachine/mouf | src/Mouf/MoufUtils.php | MoufUtils.registerChooseInstanceMenuItem | public static function registerChooseInstanceMenuItem($instanceName, $label, $url, $type, $parentMenuItemName = 'moufSubMenu', $priority = 50) {
$moufManager = MoufManager::getMoufManager();
if ($moufManager->instanceExists($instanceName)) {
return;
}
$moufManager->declareComponent($instanceName, 'Mouf\\Menu\\ChooseInstanceMenuItem', true);
$moufManager->setParameterViaSetter($instanceName, 'setLabel', $label);
$moufManager->setParameterViaSetter($instanceName, 'setUrl', $url);
$moufManager->setParameterViaSetter($instanceName, 'setType', $type);
$moufManager->setParameterViaSetter($instanceName, 'setPriority', $priority);
$parentMenuItem = MoufManager::getMoufManager()->getInstance($parentMenuItemName);
/* @var $parentMenuItem MenuItem */
$parentMenuItem->addMenuItem(MoufManager::getMoufManager()->getInstance($instanceName));
} | php | public static function registerChooseInstanceMenuItem($instanceName, $label, $url, $type, $parentMenuItemName = 'moufSubMenu', $priority = 50) {
$moufManager = MoufManager::getMoufManager();
if ($moufManager->instanceExists($instanceName)) {
return;
}
$moufManager->declareComponent($instanceName, 'Mouf\\Menu\\ChooseInstanceMenuItem', true);
$moufManager->setParameterViaSetter($instanceName, 'setLabel', $label);
$moufManager->setParameterViaSetter($instanceName, 'setUrl', $url);
$moufManager->setParameterViaSetter($instanceName, 'setType', $type);
$moufManager->setParameterViaSetter($instanceName, 'setPriority', $priority);
$parentMenuItem = MoufManager::getMoufManager()->getInstance($parentMenuItemName);
/* @var $parentMenuItem MenuItem */
$parentMenuItem->addMenuItem(MoufManager::getMoufManager()->getInstance($instanceName));
} | [
"public",
"static",
"function",
"registerChooseInstanceMenuItem",
"(",
"$",
"instanceName",
",",
"$",
"label",
",",
"$",
"url",
",",
"$",
"type",
",",
"$",
"parentMenuItemName",
"=",
"'moufSubMenu'",
",",
"$",
"priority",
"=",
"50",
")",
"{",
"$",
"moufManag... | Registers a new menuItem instance to be displayed in Mouf main menu that triggers
a popup to choose an instance.
@param string $instanceName
@param string $label
@param string $url
@param string $type
@param string $parentMenuItemName The parent menu item instance name. 'mainMenu' is the main menu item, and 'moufSubMenu' is the 'Mouf' menu
@param float $priority The position of the menu | [
"Registers",
"a",
"new",
"menuItem",
"instance",
"to",
"be",
"displayed",
"in",
"Mouf",
"main",
"menu",
"that",
"triggers",
"a",
"popup",
"to",
"choose",
"an",
"instance",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufUtils.php#L93-L109 |
38,396 | thecodingmachine/mouf | src/Mouf/MoufConfigManager.php | MoufConfigManager.getMergedConstants | public function getMergedConstants() {
$constantsInConfig = $this->getDefinedConstants();
$finalArr = $this->constantsDef;
foreach ($finalArr as $name => $constantDef) {
if (isset($constantsInConfig[$name])) {
$finalArr[$name]["value"] = $constantsInConfig[$name];
unset($constantsInConfig[$name]);
} else {
$finalArr[$name]["missinginconfigphp"] = true;
}
$finalArr[$name]["defined"] = true;
}
// Now, let's add the defined constant that have no definition in MoufComponents
foreach ($constantsInConfig as $name=>$value) {
$finalArr[$name] = array("value"=>$value, "defined"=>false);
}
return $finalArr;
} | php | public function getMergedConstants() {
$constantsInConfig = $this->getDefinedConstants();
$finalArr = $this->constantsDef;
foreach ($finalArr as $name => $constantDef) {
if (isset($constantsInConfig[$name])) {
$finalArr[$name]["value"] = $constantsInConfig[$name];
unset($constantsInConfig[$name]);
} else {
$finalArr[$name]["missinginconfigphp"] = true;
}
$finalArr[$name]["defined"] = true;
}
// Now, let's add the defined constant that have no definition in MoufComponents
foreach ($constantsInConfig as $name=>$value) {
$finalArr[$name] = array("value"=>$value, "defined"=>false);
}
return $finalArr;
} | [
"public",
"function",
"getMergedConstants",
"(",
")",
"{",
"$",
"constantsInConfig",
"=",
"$",
"this",
"->",
"getDefinedConstants",
"(",
")",
";",
"$",
"finalArr",
"=",
"$",
"this",
"->",
"constantsDef",
";",
"foreach",
"(",
"$",
"finalArr",
"as",
"$",
"na... | This function returns an array of all constants, with there attributes.
It merges the constants definitions defined in MoufComponents and the constants defined in config.php.
The returned values are in this format:
$array["constantName"] = array("defaultValue"=>"", "type"=>"string|int|float|bool", "comment"=>"some comment", "value"=>"", "defined"=>true|false, "missinginconfigphp"=>true|notdefined, , "fetchFromEnv"=>true|false);
return array | [
"This",
"function",
"returns",
"an",
"array",
"of",
"all",
"constants",
"with",
"there",
"attributes",
".",
"It",
"merges",
"the",
"constants",
"definitions",
"defined",
"in",
"MoufComponents",
"and",
"the",
"constants",
"defined",
"in",
"config",
".",
"php",
... | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufConfigManager.php#L191-L211 |
38,397 | thecodingmachine/mouf | src/Mouf/MoufInstancePropertyDescriptor.php | MoufInstancePropertyDescriptor.toInstanceDescriptor | private function toInstanceDescriptor($instanceNames) {
if ($instanceNames === null) {
return null;
}
if (is_array($instanceNames)) {
$moufManager = $this->moufManager;
return self::array_map_deep($instanceNames, function($instanceName) use ($moufManager) {
if ($instanceName != null) {
return $moufManager->getInstanceDescriptor($instanceName);
} else {
return null;
}
});
/*$arrayOfDescriptors = array();
foreach ($instanceNames as $key=>$instanceName) {
if ($instanceName != null) {
$arrayOfDescriptors[$key] = $this->moufManager->getInstanceDescriptor($instanceName);
} else {
$arrayOfDescriptors[$key] = null;
}
}
return $arrayOfDescriptors;*/
} else {
return $this->moufManager->getInstanceDescriptor($instanceNames);
}
} | php | private function toInstanceDescriptor($instanceNames) {
if ($instanceNames === null) {
return null;
}
if (is_array($instanceNames)) {
$moufManager = $this->moufManager;
return self::array_map_deep($instanceNames, function($instanceName) use ($moufManager) {
if ($instanceName != null) {
return $moufManager->getInstanceDescriptor($instanceName);
} else {
return null;
}
});
/*$arrayOfDescriptors = array();
foreach ($instanceNames as $key=>$instanceName) {
if ($instanceName != null) {
$arrayOfDescriptors[$key] = $this->moufManager->getInstanceDescriptor($instanceName);
} else {
$arrayOfDescriptors[$key] = null;
}
}
return $arrayOfDescriptors;*/
} else {
return $this->moufManager->getInstanceDescriptor($instanceNames);
}
} | [
"private",
"function",
"toInstanceDescriptor",
"(",
"$",
"instanceNames",
")",
"{",
"if",
"(",
"$",
"instanceNames",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"instanceNames",
")",
")",
"{",
"$",
"moufManager",
... | Takes in parameter a return from the getBoundComponentsXXX methods and cast that to a MoufInstanceDescriptor
or an array of MoufInstanceDescriptor.
@param string[]|string $instanceNames
@return NULL|multitype:NULL Ambigous <\Mouf\MoufInstanceDescriptor, \Mouf\array<string,> |Ambigous <\Mouf\MoufInstanceDescriptor, \Mouf\array<string,> | [
"Takes",
"in",
"parameter",
"a",
"return",
"from",
"the",
"getBoundComponentsXXX",
"methods",
"and",
"cast",
"that",
"to",
"a",
"MoufInstanceDescriptor",
"or",
"an",
"array",
"of",
"MoufInstanceDescriptor",
"."
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufInstancePropertyDescriptor.php#L175-L201 |
38,398 | thecodingmachine/mouf | src/Mouf/MoufInstancePropertyDescriptor.php | MoufInstancePropertyDescriptor.getValue | public function getValue() {
if ($this->propertyDescriptor->isPublicFieldProperty()) {
// Let's try to see if it is a "value":
$param = $this->moufManager->getParameter($this->instanceDescriptor->getIdentifierName(), $this->name);
if ($param !== null) {
return $param;
}
$instanceName = $this->moufManager->getBoundComponentsOnProperty($this->instanceDescriptor->getIdentifierName(), $this->name);
return $this->toInstanceDescriptor($instanceName);
} elseif ($this->propertyDescriptor->isSetterProperty()) {
// Let's try to see if it is a "value":
$param = $this->moufManager->getParameterForSetter($this->instanceDescriptor->getIdentifierName(), $this->name);
if ($param !== null) {
return $param;
}
$instanceName = $this->moufManager->getBoundComponentsOnSetter($this->instanceDescriptor->getIdentifierName(), $this->name);
return $this->toInstanceDescriptor($instanceName);
} elseif ($this->propertyDescriptor->isConstructor()) {
// Let's try to see if it is a "value":
$argumentType = $this->moufManager->isConstructorParameterObjectOrPrimitive($this->instanceDescriptor->getIdentifierName(), $this->propertyDescriptor->getParameterIndex());
$param = $this->moufManager->getParameterForConstructor($this->instanceDescriptor->getIdentifierName(), $this->propertyDescriptor->getParameterIndex());
if ($argumentType == "primitive") {
return $param;
} elseif ($argumentType == "object") {
return $this->toInstanceDescriptor($param);
} else {
// Not set: return null
return null;
}
} else {
throw new MoufException("Unsupported property type: it is not a public field nor a setter nor a constructor...");
}
} | php | public function getValue() {
if ($this->propertyDescriptor->isPublicFieldProperty()) {
// Let's try to see if it is a "value":
$param = $this->moufManager->getParameter($this->instanceDescriptor->getIdentifierName(), $this->name);
if ($param !== null) {
return $param;
}
$instanceName = $this->moufManager->getBoundComponentsOnProperty($this->instanceDescriptor->getIdentifierName(), $this->name);
return $this->toInstanceDescriptor($instanceName);
} elseif ($this->propertyDescriptor->isSetterProperty()) {
// Let's try to see if it is a "value":
$param = $this->moufManager->getParameterForSetter($this->instanceDescriptor->getIdentifierName(), $this->name);
if ($param !== null) {
return $param;
}
$instanceName = $this->moufManager->getBoundComponentsOnSetter($this->instanceDescriptor->getIdentifierName(), $this->name);
return $this->toInstanceDescriptor($instanceName);
} elseif ($this->propertyDescriptor->isConstructor()) {
// Let's try to see if it is a "value":
$argumentType = $this->moufManager->isConstructorParameterObjectOrPrimitive($this->instanceDescriptor->getIdentifierName(), $this->propertyDescriptor->getParameterIndex());
$param = $this->moufManager->getParameterForConstructor($this->instanceDescriptor->getIdentifierName(), $this->propertyDescriptor->getParameterIndex());
if ($argumentType == "primitive") {
return $param;
} elseif ($argumentType == "object") {
return $this->toInstanceDescriptor($param);
} else {
// Not set: return null
return null;
}
} else {
throw new MoufException("Unsupported property type: it is not a public field nor a setter nor a constructor...");
}
} | [
"public",
"function",
"getValue",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"propertyDescriptor",
"->",
"isPublicFieldProperty",
"(",
")",
")",
"{",
"// Let's try to see if it is a \"value\":",
"$",
"param",
"=",
"$",
"this",
"->",
"moufManager",
"->",
"getPa... | Returns the value for this property.
The value returned can be a primitive type, an array of primitive types, a MoufInstanceDescriptor or an array of MoufInstanceDescriptors, depending on the type of the parameter.
@return string|MoufInstanceDescriptor|null | [
"Returns",
"the",
"value",
"for",
"this",
"property",
".",
"The",
"value",
"returned",
"can",
"be",
"a",
"primitive",
"type",
"an",
"array",
"of",
"primitive",
"types",
"a",
"MoufInstanceDescriptor",
"or",
"an",
"array",
"of",
"MoufInstanceDescriptors",
"dependi... | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufInstancePropertyDescriptor.php#L222-L263 |
38,399 | thecodingmachine/mouf | src/Mouf/MoufInstancePropertyDescriptor.php | MoufInstancePropertyDescriptor.getMetaData | public function getMetaData() {
if ($this->propertyDescriptor->isPublicFieldProperty()) {
return $this->moufManager->getParameterMetadata($this->instanceDescriptor->getIdentifierName(), $this->name);
} elseif ($this->propertyDescriptor->isSetterProperty()) {
return $this->moufManager->getParameterMetadataForSetter($this->instanceDescriptor->getIdentifierName(), $this->name);
} elseif ($this->propertyDescriptor->isConstructor()) {
return $this->moufManager->getParameterMetadataForConstructor($this->instanceDescriptor->getIdentifierName(), $this->propertyDescriptor->getParameterIndex());
} else {
throw new MoufException("Unsupported property type: it is not a public field nor a setter nor a constructor...");
}
} | php | public function getMetaData() {
if ($this->propertyDescriptor->isPublicFieldProperty()) {
return $this->moufManager->getParameterMetadata($this->instanceDescriptor->getIdentifierName(), $this->name);
} elseif ($this->propertyDescriptor->isSetterProperty()) {
return $this->moufManager->getParameterMetadataForSetter($this->instanceDescriptor->getIdentifierName(), $this->name);
} elseif ($this->propertyDescriptor->isConstructor()) {
return $this->moufManager->getParameterMetadataForConstructor($this->instanceDescriptor->getIdentifierName(), $this->propertyDescriptor->getParameterIndex());
} else {
throw new MoufException("Unsupported property type: it is not a public field nor a setter nor a constructor...");
}
} | [
"public",
"function",
"getMetaData",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"propertyDescriptor",
"->",
"isPublicFieldProperty",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"moufManager",
"->",
"getParameterMetadata",
"(",
"$",
"this",
"->",
"inst... | Returns metadata for this property
@return string | [
"Returns",
"metadata",
"for",
"this",
"property"
] | b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b | https://github.com/thecodingmachine/mouf/blob/b6a11bfd4a93859c1014d5b3d54ee99314f5fc7b/src/Mouf/MoufInstancePropertyDescriptor.php#L329-L339 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.