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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
231,700
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.populateObject
|
public function populateObject(DataObject $object, $data, $fixtures)
{
if (is_array($data)) {
// Prepare Data:
$this->prepareData($data);
// Populate Fields:
$this->populateFields($object, $data, $fixtures);
// Populate Children:
$this->populateChildren($object, $data, $fixtures);
// Populate Relations:
$this->populateRelations($object, $data, $fixtures);
// Populate Objects:
$this->populateObjects($object, $data, $fixtures);
}
// Answer Object:
return $object;
}
|
php
|
public function populateObject(DataObject $object, $data, $fixtures)
{
if (is_array($data)) {
// Prepare Data:
$this->prepareData($data);
// Populate Fields:
$this->populateFields($object, $data, $fixtures);
// Populate Children:
$this->populateChildren($object, $data, $fixtures);
// Populate Relations:
$this->populateRelations($object, $data, $fixtures);
// Populate Objects:
$this->populateObjects($object, $data, $fixtures);
}
// Answer Object:
return $object;
}
|
[
"public",
"function",
"populateObject",
"(",
"DataObject",
"$",
"object",
",",
"$",
"data",
",",
"$",
"fixtures",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"// Prepare Data:",
"$",
"this",
"->",
"prepareData",
"(",
"$",
"data",
")",
";",
"// Populate Fields:",
"$",
"this",
"->",
"populateFields",
"(",
"$",
"object",
",",
"$",
"data",
",",
"$",
"fixtures",
")",
";",
"// Populate Children:",
"$",
"this",
"->",
"populateChildren",
"(",
"$",
"object",
",",
"$",
"data",
",",
"$",
"fixtures",
")",
";",
"// Populate Relations:",
"$",
"this",
"->",
"populateRelations",
"(",
"$",
"object",
",",
"$",
"data",
",",
"$",
"fixtures",
")",
";",
"// Populate Objects:",
"$",
"this",
"->",
"populateObjects",
"(",
"$",
"object",
",",
"$",
"data",
",",
"$",
"fixtures",
")",
";",
"}",
"// Answer Object:",
"return",
"$",
"object",
";",
"}"
] |
Populates the given object using fixture data.
@param DataObject $object
@param array $data
@param array $fixtures
@return DataObject
|
[
"Populates",
"the",
"given",
"object",
"using",
"fixture",
"data",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L464-L493
|
231,701
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.populateFields
|
public function populateFields(DataObject $object, $data, $fixtures)
{
// Iterate Data:
foreach ($data as $name => $value) {
if ($this->isField($object, $name)) {
$this->populateField($object, $name, $value);
}
}
// Answer Object:
return $object;
}
|
php
|
public function populateFields(DataObject $object, $data, $fixtures)
{
// Iterate Data:
foreach ($data as $name => $value) {
if ($this->isField($object, $name)) {
$this->populateField($object, $name, $value);
}
}
// Answer Object:
return $object;
}
|
[
"public",
"function",
"populateFields",
"(",
"DataObject",
"$",
"object",
",",
"$",
"data",
",",
"$",
"fixtures",
")",
"{",
"// Iterate Data:",
"foreach",
"(",
"$",
"data",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isField",
"(",
"$",
"object",
",",
"$",
"name",
")",
")",
"{",
"$",
"this",
"->",
"populateField",
"(",
"$",
"object",
",",
"$",
"name",
",",
"$",
"value",
")",
";",
"}",
"}",
"// Answer Object:",
"return",
"$",
"object",
";",
"}"
] |
Populates the fields of the given object.
@param DataObject $object
@param array $data
@param array $fixtures
@return DataObject
|
[
"Populates",
"the",
"fields",
"of",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L504-L519
|
231,702
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.populateField
|
public function populateField(DataObject $object, $name, $value)
{
// Detect Value Type:
if (is_array($value) && $object->hasField($name)) {
// Handle Array Value:
if ($object->dbObject($name) instanceof DBComposite) {
// Handle Composite Field:
foreach ($value as $k => $v) {
$object->dbObject($name)->setField($k, $this->processValue($v));
}
} else {
// Handle Regular Field (JSON-encode):
$object->setField($name, $this->processArray($value, true));
}
} else {
// Handle Regular Value:
$object->setField($name, $this->processValue($value));
}
}
|
php
|
public function populateField(DataObject $object, $name, $value)
{
// Detect Value Type:
if (is_array($value) && $object->hasField($name)) {
// Handle Array Value:
if ($object->dbObject($name) instanceof DBComposite) {
// Handle Composite Field:
foreach ($value as $k => $v) {
$object->dbObject($name)->setField($k, $this->processValue($v));
}
} else {
// Handle Regular Field (JSON-encode):
$object->setField($name, $this->processArray($value, true));
}
} else {
// Handle Regular Value:
$object->setField($name, $this->processValue($value));
}
}
|
[
"public",
"function",
"populateField",
"(",
"DataObject",
"$",
"object",
",",
"$",
"name",
",",
"$",
"value",
")",
"{",
"// Detect Value Type:",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
"&&",
"$",
"object",
"->",
"hasField",
"(",
"$",
"name",
")",
")",
"{",
"// Handle Array Value:",
"if",
"(",
"$",
"object",
"->",
"dbObject",
"(",
"$",
"name",
")",
"instanceof",
"DBComposite",
")",
"{",
"// Handle Composite Field:",
"foreach",
"(",
"$",
"value",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"object",
"->",
"dbObject",
"(",
"$",
"name",
")",
"->",
"setField",
"(",
"$",
"k",
",",
"$",
"this",
"->",
"processValue",
"(",
"$",
"v",
")",
")",
";",
"}",
"}",
"else",
"{",
"// Handle Regular Field (JSON-encode):",
"$",
"object",
"->",
"setField",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"processArray",
"(",
"$",
"value",
",",
"true",
")",
")",
";",
"}",
"}",
"else",
"{",
"// Handle Regular Value:",
"$",
"object",
"->",
"setField",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"processValue",
"(",
"$",
"value",
")",
")",
";",
"}",
"}"
] |
Populates the specified field of the given object.
@param DataObject $object
@param string $name
@param mixed $value
@return void
|
[
"Populates",
"the",
"specified",
"field",
"of",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L530-L561
|
231,703
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.populateChildren
|
public function populateChildren(DataObject $object, $data, $fixtures)
{
// Iterate Data:
foreach ($data as $name => $value) {
if ($this->isChild($object, $name)) {
// Process Child Identifier:
list($class, $identifier) = $this->processChildIdentifier($object, $name);
// Define Child Data:
$child = (array) $value;
if (!isset($child['ParentID'])) {
$child['ParentID'] = $object->ID;
}
// Define Child Filter:
$filter = ['ParentID' => $child['ParentID']];
// Create Child Object:
$this->getFactory()->createObject($class, $identifier, $child, $filter);
}
}
// Answer Object:
return $object;
}
|
php
|
public function populateChildren(DataObject $object, $data, $fixtures)
{
// Iterate Data:
foreach ($data as $name => $value) {
if ($this->isChild($object, $name)) {
// Process Child Identifier:
list($class, $identifier) = $this->processChildIdentifier($object, $name);
// Define Child Data:
$child = (array) $value;
if (!isset($child['ParentID'])) {
$child['ParentID'] = $object->ID;
}
// Define Child Filter:
$filter = ['ParentID' => $child['ParentID']];
// Create Child Object:
$this->getFactory()->createObject($class, $identifier, $child, $filter);
}
}
// Answer Object:
return $object;
}
|
[
"public",
"function",
"populateChildren",
"(",
"DataObject",
"$",
"object",
",",
"$",
"data",
",",
"$",
"fixtures",
")",
"{",
"// Iterate Data:",
"foreach",
"(",
"$",
"data",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isChild",
"(",
"$",
"object",
",",
"$",
"name",
")",
")",
"{",
"// Process Child Identifier:",
"list",
"(",
"$",
"class",
",",
"$",
"identifier",
")",
"=",
"$",
"this",
"->",
"processChildIdentifier",
"(",
"$",
"object",
",",
"$",
"name",
")",
";",
"// Define Child Data:",
"$",
"child",
"=",
"(",
"array",
")",
"$",
"value",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"child",
"[",
"'ParentID'",
"]",
")",
")",
"{",
"$",
"child",
"[",
"'ParentID'",
"]",
"=",
"$",
"object",
"->",
"ID",
";",
"}",
"// Define Child Filter:",
"$",
"filter",
"=",
"[",
"'ParentID'",
"=>",
"$",
"child",
"[",
"'ParentID'",
"]",
"]",
";",
"// Create Child Object:",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createObject",
"(",
"$",
"class",
",",
"$",
"identifier",
",",
"$",
"child",
",",
"$",
"filter",
")",
";",
"}",
"}",
"// Answer Object:",
"return",
"$",
"object",
";",
"}"
] |
Populates the children of the given object.
@param DataObject $object
@param array $data
@param array $fixtures
@return DataObject
|
[
"Populates",
"the",
"children",
"of",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L572-L607
|
231,704
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.populateObjects
|
public function populateObjects(DataObject $object, $data, $fixtures)
{
// Populate Objects:
foreach ($data as $name => $value) {
// Detect Object:
if ($this->isObject($object, $name)) {
// Trim Name:
$name = ltrim($name, '->');
// Populate Object:
if ($subObject = $object->$name) {
foreach ($value as $k => $v) {
$subObject->$k = $v;
}
$subObject->write();
}
}
}
}
|
php
|
public function populateObjects(DataObject $object, $data, $fixtures)
{
// Populate Objects:
foreach ($data as $name => $value) {
// Detect Object:
if ($this->isObject($object, $name)) {
// Trim Name:
$name = ltrim($name, '->');
// Populate Object:
if ($subObject = $object->$name) {
foreach ($value as $k => $v) {
$subObject->$k = $v;
}
$subObject->write();
}
}
}
}
|
[
"public",
"function",
"populateObjects",
"(",
"DataObject",
"$",
"object",
",",
"$",
"data",
",",
"$",
"fixtures",
")",
"{",
"// Populate Objects:",
"foreach",
"(",
"$",
"data",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"// Detect Object:",
"if",
"(",
"$",
"this",
"->",
"isObject",
"(",
"$",
"object",
",",
"$",
"name",
")",
")",
"{",
"// Trim Name:",
"$",
"name",
"=",
"ltrim",
"(",
"$",
"name",
",",
"'->'",
")",
";",
"// Populate Object:",
"if",
"(",
"$",
"subObject",
"=",
"$",
"object",
"->",
"$",
"name",
")",
"{",
"foreach",
"(",
"$",
"value",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"subObject",
"->",
"$",
"k",
"=",
"$",
"v",
";",
"}",
"$",
"subObject",
"->",
"write",
"(",
")",
";",
"}",
"}",
"}",
"}"
] |
Populates the associated objects of the given object.
@param DataObject $object
@param array $data
@param array $fixtures
@return DataObject
|
[
"Populates",
"the",
"associated",
"objects",
"of",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L618-L647
|
231,705
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.populateRelations
|
public function populateRelations(DataObject $object, $data, $fixtures)
{
// Populate Default Relations:
$this->populateDefaultRelations($object);
// Populate Relations:
foreach ($data as $name => $value) {
// Skip Object Identifiers:
if ($this->isObject($object, $name)) {
continue;
}
// Detect Relation:
if ($this->isRelation($object, $name)) {
if ($this->isHasOneRelation($object, $name)) {
// Define Has-One Association:
$this->verboseMessage(sprintf('%s is a has-one relation', $name));
$this->populateOneRelation($object, $name, $value);
} elseif ($this->isHasManyRelation($object, $name) || $this->isManyManyRelation($object, $name)) {
// Define Has-Many / Many-Many Association:
$this->verboseMessage(sprintf('%s is a has-many/many-many relation', $name));
$this->populateManyRelation($object, $name, $value);
}
}
}
// Answer Object:
return $object;
}
|
php
|
public function populateRelations(DataObject $object, $data, $fixtures)
{
// Populate Default Relations:
$this->populateDefaultRelations($object);
// Populate Relations:
foreach ($data as $name => $value) {
// Skip Object Identifiers:
if ($this->isObject($object, $name)) {
continue;
}
// Detect Relation:
if ($this->isRelation($object, $name)) {
if ($this->isHasOneRelation($object, $name)) {
// Define Has-One Association:
$this->verboseMessage(sprintf('%s is a has-one relation', $name));
$this->populateOneRelation($object, $name, $value);
} elseif ($this->isHasManyRelation($object, $name) || $this->isManyManyRelation($object, $name)) {
// Define Has-Many / Many-Many Association:
$this->verboseMessage(sprintf('%s is a has-many/many-many relation', $name));
$this->populateManyRelation($object, $name, $value);
}
}
}
// Answer Object:
return $object;
}
|
[
"public",
"function",
"populateRelations",
"(",
"DataObject",
"$",
"object",
",",
"$",
"data",
",",
"$",
"fixtures",
")",
"{",
"// Populate Default Relations:",
"$",
"this",
"->",
"populateDefaultRelations",
"(",
"$",
"object",
")",
";",
"// Populate Relations:",
"foreach",
"(",
"$",
"data",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"// Skip Object Identifiers:",
"if",
"(",
"$",
"this",
"->",
"isObject",
"(",
"$",
"object",
",",
"$",
"name",
")",
")",
"{",
"continue",
";",
"}",
"// Detect Relation:",
"if",
"(",
"$",
"this",
"->",
"isRelation",
"(",
"$",
"object",
",",
"$",
"name",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isHasOneRelation",
"(",
"$",
"object",
",",
"$",
"name",
")",
")",
"{",
"// Define Has-One Association:",
"$",
"this",
"->",
"verboseMessage",
"(",
"sprintf",
"(",
"'%s is a has-one relation'",
",",
"$",
"name",
")",
")",
";",
"$",
"this",
"->",
"populateOneRelation",
"(",
"$",
"object",
",",
"$",
"name",
",",
"$",
"value",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"isHasManyRelation",
"(",
"$",
"object",
",",
"$",
"name",
")",
"||",
"$",
"this",
"->",
"isManyManyRelation",
"(",
"$",
"object",
",",
"$",
"name",
")",
")",
"{",
"// Define Has-Many / Many-Many Association:",
"$",
"this",
"->",
"verboseMessage",
"(",
"sprintf",
"(",
"'%s is a has-many/many-many relation'",
",",
"$",
"name",
")",
")",
";",
"$",
"this",
"->",
"populateManyRelation",
"(",
"$",
"object",
",",
"$",
"name",
",",
"$",
"value",
")",
";",
"}",
"}",
"}",
"// Answer Object:",
"return",
"$",
"object",
";",
"}"
] |
Populates the relations of the given object.
@param DataObject $object
@param array $data
@param array $fixtures
@return DataObject
|
[
"Populates",
"the",
"relations",
"of",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L658-L703
|
231,706
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.populateOneRelation
|
public function populateOneRelation(DataObject $object, $field, $value)
{
// Trim Field ID:
$field = $this->trimID($field);
// Obtain Relation Class:
if ($hasOneClass = $this->getSchema()->hasOneComponent($object, $field)) {
// Define Relation:
if ($this->isFile($hasOneClass)) {
$object->{$field . 'ID'} = $this->processFile($object, $field, $value, $hasOneClass);
} else {
$object->{$field . 'ID'} = $this->processValue($value);
}
// Handle Polymorphic Relation:
if ($this->isReference($value)) {
list($class, $identifier) = $this->processTypedIdentifier($value);
if ($hasOneClass === DataObject::class) {
$object->{$field . 'Class'} = $class;
}
}
}
// Answer Object:
return $object;
}
|
php
|
public function populateOneRelation(DataObject $object, $field, $value)
{
// Trim Field ID:
$field = $this->trimID($field);
// Obtain Relation Class:
if ($hasOneClass = $this->getSchema()->hasOneComponent($object, $field)) {
// Define Relation:
if ($this->isFile($hasOneClass)) {
$object->{$field . 'ID'} = $this->processFile($object, $field, $value, $hasOneClass);
} else {
$object->{$field . 'ID'} = $this->processValue($value);
}
// Handle Polymorphic Relation:
if ($this->isReference($value)) {
list($class, $identifier) = $this->processTypedIdentifier($value);
if ($hasOneClass === DataObject::class) {
$object->{$field . 'Class'} = $class;
}
}
}
// Answer Object:
return $object;
}
|
[
"public",
"function",
"populateOneRelation",
"(",
"DataObject",
"$",
"object",
",",
"$",
"field",
",",
"$",
"value",
")",
"{",
"// Trim Field ID:",
"$",
"field",
"=",
"$",
"this",
"->",
"trimID",
"(",
"$",
"field",
")",
";",
"// Obtain Relation Class:",
"if",
"(",
"$",
"hasOneClass",
"=",
"$",
"this",
"->",
"getSchema",
"(",
")",
"->",
"hasOneComponent",
"(",
"$",
"object",
",",
"$",
"field",
")",
")",
"{",
"// Define Relation:",
"if",
"(",
"$",
"this",
"->",
"isFile",
"(",
"$",
"hasOneClass",
")",
")",
"{",
"$",
"object",
"->",
"{",
"$",
"field",
".",
"'ID'",
"}",
"=",
"$",
"this",
"->",
"processFile",
"(",
"$",
"object",
",",
"$",
"field",
",",
"$",
"value",
",",
"$",
"hasOneClass",
")",
";",
"}",
"else",
"{",
"$",
"object",
"->",
"{",
"$",
"field",
".",
"'ID'",
"}",
"=",
"$",
"this",
"->",
"processValue",
"(",
"$",
"value",
")",
";",
"}",
"// Handle Polymorphic Relation:",
"if",
"(",
"$",
"this",
"->",
"isReference",
"(",
"$",
"value",
")",
")",
"{",
"list",
"(",
"$",
"class",
",",
"$",
"identifier",
")",
"=",
"$",
"this",
"->",
"processTypedIdentifier",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"hasOneClass",
"===",
"DataObject",
"::",
"class",
")",
"{",
"$",
"object",
"->",
"{",
"$",
"field",
".",
"'Class'",
"}",
"=",
"$",
"class",
";",
"}",
"}",
"}",
"// Answer Object:",
"return",
"$",
"object",
";",
"}"
] |
Populates a has-one relation for the given object.
@param DataObject $object
@param string $field
@param mixed $value
@return DataObject
|
[
"Populates",
"a",
"has",
"-",
"one",
"relation",
"for",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L714-L749
|
231,707
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.populateDefaultRelations
|
public function populateDefaultRelations(DataObject $object)
{
foreach ($object->hasOne() as $name => $class) {
if ($id = $this->getDefaultRelation($class)) {
$object->{$name . 'ID'} = $id;
}
}
return $object;
}
|
php
|
public function populateDefaultRelations(DataObject $object)
{
foreach ($object->hasOne() as $name => $class) {
if ($id = $this->getDefaultRelation($class)) {
$object->{$name . 'ID'} = $id;
}
}
return $object;
}
|
[
"public",
"function",
"populateDefaultRelations",
"(",
"DataObject",
"$",
"object",
")",
"{",
"foreach",
"(",
"$",
"object",
"->",
"hasOne",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"class",
")",
"{",
"if",
"(",
"$",
"id",
"=",
"$",
"this",
"->",
"getDefaultRelation",
"(",
"$",
"class",
")",
")",
"{",
"$",
"object",
"->",
"{",
"$",
"name",
".",
"'ID'",
"}",
"=",
"$",
"id",
";",
"}",
"}",
"return",
"$",
"object",
";",
"}"
] |
Populates the default relations of the given object.
@param DataObject $object
@return DataObject
|
[
"Populates",
"the",
"default",
"relations",
"of",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L866-L877
|
231,708
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.populateIdentifier
|
public function populateIdentifier(DataObject $object, $identifier)
{
if ($field = $this->getDefaultIdentifier()) {
return $object->setField($field, $identifier);
} else {
if ($this->getSchema()->fieldSpec($object, 'Title')) {
return $object->setField('Title', $this->getIdentifierAsTitle($identifier));
}
if ($this->getSchema()->fieldSpec($object, 'Name')) {
return $object->setField('Name', $this->getIdentifierAsTitle($identifier));
}
}
return $object;
}
|
php
|
public function populateIdentifier(DataObject $object, $identifier)
{
if ($field = $this->getDefaultIdentifier()) {
return $object->setField($field, $identifier);
} else {
if ($this->getSchema()->fieldSpec($object, 'Title')) {
return $object->setField('Title', $this->getIdentifierAsTitle($identifier));
}
if ($this->getSchema()->fieldSpec($object, 'Name')) {
return $object->setField('Name', $this->getIdentifierAsTitle($identifier));
}
}
return $object;
}
|
[
"public",
"function",
"populateIdentifier",
"(",
"DataObject",
"$",
"object",
",",
"$",
"identifier",
")",
"{",
"if",
"(",
"$",
"field",
"=",
"$",
"this",
"->",
"getDefaultIdentifier",
"(",
")",
")",
"{",
"return",
"$",
"object",
"->",
"setField",
"(",
"$",
"field",
",",
"$",
"identifier",
")",
";",
"}",
"else",
"{",
"if",
"(",
"$",
"this",
"->",
"getSchema",
"(",
")",
"->",
"fieldSpec",
"(",
"$",
"object",
",",
"'Title'",
")",
")",
"{",
"return",
"$",
"object",
"->",
"setField",
"(",
"'Title'",
",",
"$",
"this",
"->",
"getIdentifierAsTitle",
"(",
"$",
"identifier",
")",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getSchema",
"(",
")",
"->",
"fieldSpec",
"(",
"$",
"object",
",",
"'Name'",
")",
")",
"{",
"return",
"$",
"object",
"->",
"setField",
"(",
"'Name'",
",",
"$",
"this",
"->",
"getIdentifierAsTitle",
"(",
"$",
"identifier",
")",
")",
";",
"}",
"}",
"return",
"$",
"object",
";",
"}"
] |
Populates the identifier field for the given object.
@param DataObject $object
@param string $identifier
@return DataObject
|
[
"Populates",
"the",
"identifier",
"field",
"for",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L887-L906
|
231,709
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.populateDefaults
|
public function populateDefaults(DataObject $object, $identifier, $data, $fixtures)
{
// Iterate Defaults:
foreach ($this->getDefaults() as $name => $value) {
// Is Value Callable?
if (is_callable($value)) {
$object->$name = $value($object, $data, $fixtures);
} else {
$object->$name = $value;
}
}
// Answer Object:
return $object;
}
|
php
|
public function populateDefaults(DataObject $object, $identifier, $data, $fixtures)
{
// Iterate Defaults:
foreach ($this->getDefaults() as $name => $value) {
// Is Value Callable?
if (is_callable($value)) {
$object->$name = $value($object, $data, $fixtures);
} else {
$object->$name = $value;
}
}
// Answer Object:
return $object;
}
|
[
"public",
"function",
"populateDefaults",
"(",
"DataObject",
"$",
"object",
",",
"$",
"identifier",
",",
"$",
"data",
",",
"$",
"fixtures",
")",
"{",
"// Iterate Defaults:",
"foreach",
"(",
"$",
"this",
"->",
"getDefaults",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"// Is Value Callable?",
"if",
"(",
"is_callable",
"(",
"$",
"value",
")",
")",
"{",
"$",
"object",
"->",
"$",
"name",
"=",
"$",
"value",
"(",
"$",
"object",
",",
"$",
"data",
",",
"$",
"fixtures",
")",
";",
"}",
"else",
"{",
"$",
"object",
"->",
"$",
"name",
"=",
"$",
"value",
";",
"}",
"}",
"// Answer Object:",
"return",
"$",
"object",
";",
"}"
] |
Populates the defaults for the given object.
@param DataObject $object
@param string $identifier
@param array $data
@param array $fixtures
@return DataObject
|
[
"Populates",
"the",
"defaults",
"for",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L918-L937
|
231,710
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.populateParent
|
public function populateParent(DataObject $object, $data)
{
// Define Parent:
if (isset($data['ParentID'])) {
$object->ParentID = $data['ParentID'];
}
// Answer Object:
return $object;
}
|
php
|
public function populateParent(DataObject $object, $data)
{
// Define Parent:
if (isset($data['ParentID'])) {
$object->ParentID = $data['ParentID'];
}
// Answer Object:
return $object;
}
|
[
"public",
"function",
"populateParent",
"(",
"DataObject",
"$",
"object",
",",
"$",
"data",
")",
"{",
"// Define Parent:",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'ParentID'",
"]",
")",
")",
"{",
"$",
"object",
"->",
"ParentID",
"=",
"$",
"data",
"[",
"'ParentID'",
"]",
";",
"}",
"// Answer Object:",
"return",
"$",
"object",
";",
"}"
] |
Populates the parent relation for the given object.
@param DataObject $object
@param array $data
@return DataObject
|
[
"Populates",
"the",
"parent",
"relation",
"for",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L947-L958
|
231,711
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.isChild
|
public function isChild(DataObject $object, $name)
{
return ($this->isChildIdentifier($name) && $object->hasExtension(Hierarchy::class));
}
|
php
|
public function isChild(DataObject $object, $name)
{
return ($this->isChildIdentifier($name) && $object->hasExtension(Hierarchy::class));
}
|
[
"public",
"function",
"isChild",
"(",
"DataObject",
"$",
"object",
",",
"$",
"name",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"isChildIdentifier",
"(",
"$",
"name",
")",
"&&",
"$",
"object",
"->",
"hasExtension",
"(",
"Hierarchy",
"::",
"class",
")",
")",
";",
"}"
] |
Answers true if the specified field is a child of the given object.
@param DataObject $object
@param string $name
@return boolean
|
[
"Answers",
"true",
"if",
"the",
"specified",
"field",
"is",
"a",
"child",
"of",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L968-L971
|
231,712
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.isField
|
public function isField(DataObject $object, $name)
{
return (
!$this->isRelation($object, $name) &&
!$this->isObject($object, $name) &&
!$this->isChild($object, $name)
);
}
|
php
|
public function isField(DataObject $object, $name)
{
return (
!$this->isRelation($object, $name) &&
!$this->isObject($object, $name) &&
!$this->isChild($object, $name)
);
}
|
[
"public",
"function",
"isField",
"(",
"DataObject",
"$",
"object",
",",
"$",
"name",
")",
"{",
"return",
"(",
"!",
"$",
"this",
"->",
"isRelation",
"(",
"$",
"object",
",",
"$",
"name",
")",
"&&",
"!",
"$",
"this",
"->",
"isObject",
"(",
"$",
"object",
",",
"$",
"name",
")",
"&&",
"!",
"$",
"this",
"->",
"isChild",
"(",
"$",
"object",
",",
"$",
"name",
")",
")",
";",
"}"
] |
Answers true if the specified field is a regular field of the given object.
@param DataObject $object
@param string $name
@return boolean
|
[
"Answers",
"true",
"if",
"the",
"specified",
"field",
"is",
"a",
"regular",
"field",
"of",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L981-L988
|
231,713
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.isObject
|
public function isObject(DataObject $object, $name)
{
$identifier = ltrim($name, '->');
return ($this->isObjectIdentifier($name) && is_object($object->$identifier));
}
|
php
|
public function isObject(DataObject $object, $name)
{
$identifier = ltrim($name, '->');
return ($this->isObjectIdentifier($name) && is_object($object->$identifier));
}
|
[
"public",
"function",
"isObject",
"(",
"DataObject",
"$",
"object",
",",
"$",
"name",
")",
"{",
"$",
"identifier",
"=",
"ltrim",
"(",
"$",
"name",
",",
"'->'",
")",
";",
"return",
"(",
"$",
"this",
"->",
"isObjectIdentifier",
"(",
"$",
"name",
")",
"&&",
"is_object",
"(",
"$",
"object",
"->",
"$",
"identifier",
")",
")",
";",
"}"
] |
Answers true if the specified field is an object associated with the given object.
@param DataObject $object
@param string $name
@return boolean
|
[
"Answers",
"true",
"if",
"the",
"specified",
"field",
"is",
"an",
"object",
"associated",
"with",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L998-L1003
|
231,714
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.isRelation
|
public function isRelation(DataObject $object, $name)
{
return (
$this->isHasOneRelation($object, $name) ||
$this->isHasManyRelation($object, $name) ||
$this->isManyManyRelation($object, $name)
);
}
|
php
|
public function isRelation(DataObject $object, $name)
{
return (
$this->isHasOneRelation($object, $name) ||
$this->isHasManyRelation($object, $name) ||
$this->isManyManyRelation($object, $name)
);
}
|
[
"public",
"function",
"isRelation",
"(",
"DataObject",
"$",
"object",
",",
"$",
"name",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"isHasOneRelation",
"(",
"$",
"object",
",",
"$",
"name",
")",
"||",
"$",
"this",
"->",
"isHasManyRelation",
"(",
"$",
"object",
",",
"$",
"name",
")",
"||",
"$",
"this",
"->",
"isManyManyRelation",
"(",
"$",
"object",
",",
"$",
"name",
")",
")",
";",
"}"
] |
Answers true if the specified field is a relation of the given object.
@param DataObject $object
@param string $name
@return boolean
|
[
"Answers",
"true",
"if",
"the",
"specified",
"field",
"is",
"a",
"relation",
"of",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1085-L1092
|
231,715
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.isHasOneRelation
|
public function isHasOneRelation(DataObject $object, $name)
{
return (
$this->getSchema()->hasOneComponent($object, $name) ||
$this->getSchema()->hasOneComponent($object, $this->trimID($name))
);
}
|
php
|
public function isHasOneRelation(DataObject $object, $name)
{
return (
$this->getSchema()->hasOneComponent($object, $name) ||
$this->getSchema()->hasOneComponent($object, $this->trimID($name))
);
}
|
[
"public",
"function",
"isHasOneRelation",
"(",
"DataObject",
"$",
"object",
",",
"$",
"name",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"getSchema",
"(",
")",
"->",
"hasOneComponent",
"(",
"$",
"object",
",",
"$",
"name",
")",
"||",
"$",
"this",
"->",
"getSchema",
"(",
")",
"->",
"hasOneComponent",
"(",
"$",
"object",
",",
"$",
"this",
"->",
"trimID",
"(",
"$",
"name",
")",
")",
")",
";",
"}"
] |
Answers true if the specified field is a has-one relation of the given object.
@param DataObject $object
@param string $name
@return boolean
|
[
"Answers",
"true",
"if",
"the",
"specified",
"field",
"is",
"a",
"has",
"-",
"one",
"relation",
"of",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1102-L1108
|
231,716
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.isHasManyRelation
|
public function isHasManyRelation(DataObject $object, $name)
{
return (boolean) $this->getSchema()->hasManyComponent($object, $name);
}
|
php
|
public function isHasManyRelation(DataObject $object, $name)
{
return (boolean) $this->getSchema()->hasManyComponent($object, $name);
}
|
[
"public",
"function",
"isHasManyRelation",
"(",
"DataObject",
"$",
"object",
",",
"$",
"name",
")",
"{",
"return",
"(",
"boolean",
")",
"$",
"this",
"->",
"getSchema",
"(",
")",
"->",
"hasManyComponent",
"(",
"$",
"object",
",",
"$",
"name",
")",
";",
"}"
] |
Answers true if the specified field is a has-many relation of the given object.
@param DataObject $object
@param string $name
@return boolean
|
[
"Answers",
"true",
"if",
"the",
"specified",
"field",
"is",
"a",
"has",
"-",
"many",
"relation",
"of",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1118-L1121
|
231,717
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.isManyManyRelation
|
public function isManyManyRelation(DataObject $object, $name)
{
return (boolean) $this->getSchema()->manyManyComponent($object, $name);
}
|
php
|
public function isManyManyRelation(DataObject $object, $name)
{
return (boolean) $this->getSchema()->manyManyComponent($object, $name);
}
|
[
"public",
"function",
"isManyManyRelation",
"(",
"DataObject",
"$",
"object",
",",
"$",
"name",
")",
"{",
"return",
"(",
"boolean",
")",
"$",
"this",
"->",
"getSchema",
"(",
")",
"->",
"manyManyComponent",
"(",
"$",
"object",
",",
"$",
"name",
")",
";",
"}"
] |
Answers true if the specified field is a many-many relation of the given object.
@param DataObject $object
@param string $name
@return boolean
|
[
"Answers",
"true",
"if",
"the",
"specified",
"field",
"is",
"a",
"many",
"-",
"many",
"relation",
"of",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1131-L1134
|
231,718
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.getDefaultParent
|
public function getDefaultParent()
{
if ($defaultParents = $this->config()->default_parents) {
if (isset($defaultParents[$this->getClass()])) {
$result = $this->processValue($defaultParents[$this->getClass()]);
if ($result instanceof DataObject) {
return $result->ID;
}
return $result;
}
}
}
|
php
|
public function getDefaultParent()
{
if ($defaultParents = $this->config()->default_parents) {
if (isset($defaultParents[$this->getClass()])) {
$result = $this->processValue($defaultParents[$this->getClass()]);
if ($result instanceof DataObject) {
return $result->ID;
}
return $result;
}
}
}
|
[
"public",
"function",
"getDefaultParent",
"(",
")",
"{",
"if",
"(",
"$",
"defaultParents",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"default_parents",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"defaultParents",
"[",
"$",
"this",
"->",
"getClass",
"(",
")",
"]",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"processValue",
"(",
"$",
"defaultParents",
"[",
"$",
"this",
"->",
"getClass",
"(",
")",
"]",
")",
";",
"if",
"(",
"$",
"result",
"instanceof",
"DataObject",
")",
"{",
"return",
"$",
"result",
"->",
"ID",
";",
"}",
"return",
"$",
"result",
";",
"}",
"}",
"}"
] |
Answers the default parent for the associated class.
@return integer
|
[
"Answers",
"the",
"default",
"parent",
"for",
"the",
"associated",
"class",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1233-L1250
|
231,719
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.getDefaultRelation
|
public function getDefaultRelation($class)
{
if ($defaultRelations = $this->config()->default_relations) {
if (isset($defaultRelations[$class])) {
$result = $this->processValue($defaultRelations[$class]);
if ($result instanceof DataObject) {
return $result->ID;
}
return $result;
}
}
}
|
php
|
public function getDefaultRelation($class)
{
if ($defaultRelations = $this->config()->default_relations) {
if (isset($defaultRelations[$class])) {
$result = $this->processValue($defaultRelations[$class]);
if ($result instanceof DataObject) {
return $result->ID;
}
return $result;
}
}
}
|
[
"public",
"function",
"getDefaultRelation",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"$",
"defaultRelations",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"default_relations",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"defaultRelations",
"[",
"$",
"class",
"]",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"processValue",
"(",
"$",
"defaultRelations",
"[",
"$",
"class",
"]",
")",
";",
"if",
"(",
"$",
"result",
"instanceof",
"DataObject",
")",
"{",
"return",
"$",
"result",
"->",
"ID",
";",
"}",
"return",
"$",
"result",
";",
"}",
"}",
"}"
] |
Answers the default relation for the specified class.
@param string $class
@return integer
|
[
"Answers",
"the",
"default",
"relation",
"for",
"the",
"specified",
"class",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1259-L1276
|
231,720
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.getDefaultIdentifier
|
public function getDefaultIdentifier()
{
if ($defaultIdentifiers = $this->config()->default_identifiers) {
if (isset($defaultIdentifiers[$this->getClass()])) {
return $defaultIdentifiers[$this->getClass()];
}
}
}
|
php
|
public function getDefaultIdentifier()
{
if ($defaultIdentifiers = $this->config()->default_identifiers) {
if (isset($defaultIdentifiers[$this->getClass()])) {
return $defaultIdentifiers[$this->getClass()];
}
}
}
|
[
"public",
"function",
"getDefaultIdentifier",
"(",
")",
"{",
"if",
"(",
"$",
"defaultIdentifiers",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"default_identifiers",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"defaultIdentifiers",
"[",
"$",
"this",
"->",
"getClass",
"(",
")",
"]",
")",
")",
"{",
"return",
"$",
"defaultIdentifiers",
"[",
"$",
"this",
"->",
"getClass",
"(",
")",
"]",
";",
"}",
"}",
"}"
] |
Answers the default identifier for the associated class.
@return string
|
[
"Answers",
"the",
"default",
"identifier",
"for",
"the",
"associated",
"class",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1283-L1292
|
231,721
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.getRelationList
|
public function getRelationList(DataObject $object, $field)
{
if ($this->isHasManyRelation($object, $field)) {
return $object->getComponents($field);
} elseif ($this->isManyManyRelation($object, $field)) {
return $object->getManyManyComponents($field);
}
}
|
php
|
public function getRelationList(DataObject $object, $field)
{
if ($this->isHasManyRelation($object, $field)) {
return $object->getComponents($field);
} elseif ($this->isManyManyRelation($object, $field)) {
return $object->getManyManyComponents($field);
}
}
|
[
"public",
"function",
"getRelationList",
"(",
"DataObject",
"$",
"object",
",",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isHasManyRelation",
"(",
"$",
"object",
",",
"$",
"field",
")",
")",
"{",
"return",
"$",
"object",
"->",
"getComponents",
"(",
"$",
"field",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"isManyManyRelation",
"(",
"$",
"object",
",",
"$",
"field",
")",
")",
"{",
"return",
"$",
"object",
"->",
"getManyManyComponents",
"(",
"$",
"field",
")",
";",
"}",
"}"
] |
Answers the relation list from the given object with the specified field name.
@param DataObject $object
@param string $field
@return RelationList
|
[
"Answers",
"the",
"relation",
"list",
"from",
"the",
"given",
"object",
"with",
"the",
"specified",
"field",
"name",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1302-L1309
|
231,722
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.createMessage
|
public function createMessage(DataObject $object, $identifier)
{
$this->changeMessage(sprintf('Creating %s.%s', get_class($object), $identifier), 'created');
}
|
php
|
public function createMessage(DataObject $object, $identifier)
{
$this->changeMessage(sprintf('Creating %s.%s', get_class($object), $identifier), 'created');
}
|
[
"public",
"function",
"createMessage",
"(",
"DataObject",
"$",
"object",
",",
"$",
"identifier",
")",
"{",
"$",
"this",
"->",
"changeMessage",
"(",
"sprintf",
"(",
"'Creating %s.%s'",
",",
"get_class",
"(",
"$",
"object",
")",
",",
"$",
"identifier",
")",
",",
"'created'",
")",
";",
"}"
] |
Shows a database create message for the given object.
@param DataObject $object
@param string $identifier
@return void
|
[
"Shows",
"a",
"database",
"create",
"message",
"for",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1319-L1322
|
231,723
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.updateMessage
|
public function updateMessage(DataObject $object, $identifier)
{
$this->changeMessage(sprintf('Updating %s.%s', get_class($object), $identifier), 'changed');
}
|
php
|
public function updateMessage(DataObject $object, $identifier)
{
$this->changeMessage(sprintf('Updating %s.%s', get_class($object), $identifier), 'changed');
}
|
[
"public",
"function",
"updateMessage",
"(",
"DataObject",
"$",
"object",
",",
"$",
"identifier",
")",
"{",
"$",
"this",
"->",
"changeMessage",
"(",
"sprintf",
"(",
"'Updating %s.%s'",
",",
"get_class",
"(",
"$",
"object",
")",
",",
"$",
"identifier",
")",
",",
"'changed'",
")",
";",
"}"
] |
Shows a database update message for the given object.
@param DataObject $object
@param string $identifier
@return void
|
[
"Shows",
"a",
"database",
"update",
"message",
"for",
"the",
"given",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1332-L1335
|
231,724
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.disableValidation
|
protected function disableValidation()
{
// Nest Configuration:
Config::nest();
// Update DataObject / File Configuration:
Config::inst()->update('SilverStripe\ORM\DataObject', 'validation_enabled', false);
Config::inst()->update('SilverStripe\Assets\File', 'update_filesystem', false);
// Answer Self:
return $this;
}
|
php
|
protected function disableValidation()
{
// Nest Configuration:
Config::nest();
// Update DataObject / File Configuration:
Config::inst()->update('SilverStripe\ORM\DataObject', 'validation_enabled', false);
Config::inst()->update('SilverStripe\Assets\File', 'update_filesystem', false);
// Answer Self:
return $this;
}
|
[
"protected",
"function",
"disableValidation",
"(",
")",
"{",
"// Nest Configuration:",
"Config",
"::",
"nest",
"(",
")",
";",
"// Update DataObject / File Configuration:",
"Config",
"::",
"inst",
"(",
")",
"->",
"update",
"(",
"'SilverStripe\\ORM\\DataObject'",
",",
"'validation_enabled'",
",",
"false",
")",
";",
"Config",
"::",
"inst",
"(",
")",
"->",
"update",
"(",
"'SilverStripe\\Assets\\File'",
",",
"'update_filesystem'",
",",
"false",
")",
";",
"// Answer Self:",
"return",
"$",
"this",
";",
"}"
] |
Disables data object validation while importing fixtures.
@return $this
|
[
"Disables",
"data",
"object",
"validation",
"while",
"importing",
"fixtures",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1381-L1395
|
231,725
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.onBeforeCreate
|
protected function onBeforeCreate($identifier, &$data, &$fixtures)
{
$this->disableValidation()->invokeCallbacks('beforeCreate', [$identifier, $data, $fixtures]);
}
|
php
|
protected function onBeforeCreate($identifier, &$data, &$fixtures)
{
$this->disableValidation()->invokeCallbacks('beforeCreate', [$identifier, $data, $fixtures]);
}
|
[
"protected",
"function",
"onBeforeCreate",
"(",
"$",
"identifier",
",",
"&",
"$",
"data",
",",
"&",
"$",
"fixtures",
")",
"{",
"$",
"this",
"->",
"disableValidation",
"(",
")",
"->",
"invokeCallbacks",
"(",
"'beforeCreate'",
",",
"[",
"$",
"identifier",
",",
"$",
"data",
",",
"$",
"fixtures",
"]",
")",
";",
"}"
] |
Event method called before the object is created.
@param string $identifier
@param array $data
@param array $fixtures
@return void
|
[
"Event",
"method",
"called",
"before",
"the",
"object",
"is",
"created",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1422-L1425
|
231,726
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.onAfterCreate
|
protected function onAfterCreate(DataObject $object, $identifier, &$data, &$fixtures)
{
$this->enableValidation()->invokeCallbacks('afterCreate', [$object, $identifier, $data, $fixtures]);
}
|
php
|
protected function onAfterCreate(DataObject $object, $identifier, &$data, &$fixtures)
{
$this->enableValidation()->invokeCallbacks('afterCreate', [$object, $identifier, $data, $fixtures]);
}
|
[
"protected",
"function",
"onAfterCreate",
"(",
"DataObject",
"$",
"object",
",",
"$",
"identifier",
",",
"&",
"$",
"data",
",",
"&",
"$",
"fixtures",
")",
"{",
"$",
"this",
"->",
"enableValidation",
"(",
")",
"->",
"invokeCallbacks",
"(",
"'afterCreate'",
",",
"[",
"$",
"object",
",",
"$",
"identifier",
",",
"$",
"data",
",",
"$",
"fixtures",
"]",
")",
";",
"}"
] |
Event method called after the object is created.
@param DataObject $object
@param string $identifier
@param array $data
@param array $fixtures
@return void
|
[
"Event",
"method",
"called",
"after",
"the",
"object",
"is",
"created",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1437-L1440
|
231,727
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.processValue
|
protected function processValue($value)
{
if (is_array($value)) {
// Handle Array Value:
$value = $this->processArray($value);
} else {
// Handle String Value:
$value = trim($value);
if ($this->isReference($value)) {
return $this->processReference($value);
}
}
// Answer Value:
return $value;
}
|
php
|
protected function processValue($value)
{
if (is_array($value)) {
// Handle Array Value:
$value = $this->processArray($value);
} else {
// Handle String Value:
$value = trim($value);
if ($this->isReference($value)) {
return $this->processReference($value);
}
}
// Answer Value:
return $value;
}
|
[
"protected",
"function",
"processValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"// Handle Array Value:",
"$",
"value",
"=",
"$",
"this",
"->",
"processArray",
"(",
"$",
"value",
")",
";",
"}",
"else",
"{",
"// Handle String Value:",
"$",
"value",
"=",
"trim",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isReference",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"this",
"->",
"processReference",
"(",
"$",
"value",
")",
";",
"}",
"}",
"// Answer Value:",
"return",
"$",
"value",
";",
"}"
] |
Processes the given value and answers the resulting data.
@param string|array $value
@return mixed
|
[
"Processes",
"the",
"given",
"value",
"and",
"answers",
"the",
"resulting",
"data",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1449-L1472
|
231,728
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.processArray
|
protected function processArray($value, $json = false)
{
if (is_array($value)) {
if ($this->isCallbackArray($value)) {
return $this->processCallbackArray($value);
}
return $json ? json_encode($value) : implode(', ', $value);
}
return $value;
}
|
php
|
protected function processArray($value, $json = false)
{
if (is_array($value)) {
if ($this->isCallbackArray($value)) {
return $this->processCallbackArray($value);
}
return $json ? json_encode($value) : implode(', ', $value);
}
return $value;
}
|
[
"protected",
"function",
"processArray",
"(",
"$",
"value",
",",
"$",
"json",
"=",
"false",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isCallbackArray",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"this",
"->",
"processCallbackArray",
"(",
"$",
"value",
")",
";",
"}",
"return",
"$",
"json",
"?",
"json_encode",
"(",
"$",
"value",
")",
":",
"implode",
"(",
"', '",
",",
"$",
"value",
")",
";",
"}",
"return",
"$",
"value",
";",
"}"
] |
Processes the given array value and answers the resulting data.
@param array $value
@param boolean $json
@return mixed
|
[
"Processes",
"the",
"given",
"array",
"value",
"and",
"answers",
"the",
"resulting",
"data",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1482-L1495
|
231,729
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.processCallbackArray
|
protected function processCallbackArray($value)
{
if ($this->isCallbackArray($value)) {
$class = $value['class'];
$method = $value['method'];
if ($result = call_user_func("{$class}::{$method}")) {
if (isset($value['property'])) {
return $result->{$value['property']};
}
return $result;
}
}
}
|
php
|
protected function processCallbackArray($value)
{
if ($this->isCallbackArray($value)) {
$class = $value['class'];
$method = $value['method'];
if ($result = call_user_func("{$class}::{$method}")) {
if (isset($value['property'])) {
return $result->{$value['property']};
}
return $result;
}
}
}
|
[
"protected",
"function",
"processCallbackArray",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isCallbackArray",
"(",
"$",
"value",
")",
")",
"{",
"$",
"class",
"=",
"$",
"value",
"[",
"'class'",
"]",
";",
"$",
"method",
"=",
"$",
"value",
"[",
"'method'",
"]",
";",
"if",
"(",
"$",
"result",
"=",
"call_user_func",
"(",
"\"{$class}::{$method}\"",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"value",
"[",
"'property'",
"]",
")",
")",
"{",
"return",
"$",
"result",
"->",
"{",
"$",
"value",
"[",
"'property'",
"]",
"}",
";",
"}",
"return",
"$",
"result",
";",
"}",
"}",
"}"
] |
Processes the given callback array value and answers the resulting data.
@param array $value
@return mixed
|
[
"Processes",
"the",
"given",
"callback",
"array",
"value",
"and",
"answers",
"the",
"resulting",
"data",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1504-L1522
|
231,730
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.processFile
|
protected function processFile(DataObject $object, $field, $value, $class)
{
// Initialise:
$source = null;
$folder = null;
// Detect Value Type:
if (is_array($value)) {
// Handle Array Value:
$source = isset($value['Source']) ? $value['Source'] : null;
$folder = isset($value['Folder']) ? $value['Folder'] : null;
} else {
// Handle String Value:
$source = $value;
}
// Obtain Folder (if required):
if (!$folder) {
$folder = $this->getFolderName($object, $field);
}
// Obtain Source Path:
$path = Director::getAbsFile($source);
// Does Source Exist?
if (file_exists($path)) {
// Obtain Base Name:
$basename = basename($path);
// Define Asset Filename:
$filename = sprintf('%s/%s', $folder, $basename);
// Obtain or Create File:
if (!($file = File::find($filename))) {
$file = Injector::inst()->create($class);
}
// Define File Contents:
$file->setFromLocalFile($path, $filename);
// Write and Publish File:
$file->write();
$file->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
// Answer File ID:
return $file->ID;
}
}
|
php
|
protected function processFile(DataObject $object, $field, $value, $class)
{
// Initialise:
$source = null;
$folder = null;
// Detect Value Type:
if (is_array($value)) {
// Handle Array Value:
$source = isset($value['Source']) ? $value['Source'] : null;
$folder = isset($value['Folder']) ? $value['Folder'] : null;
} else {
// Handle String Value:
$source = $value;
}
// Obtain Folder (if required):
if (!$folder) {
$folder = $this->getFolderName($object, $field);
}
// Obtain Source Path:
$path = Director::getAbsFile($source);
// Does Source Exist?
if (file_exists($path)) {
// Obtain Base Name:
$basename = basename($path);
// Define Asset Filename:
$filename = sprintf('%s/%s', $folder, $basename);
// Obtain or Create File:
if (!($file = File::find($filename))) {
$file = Injector::inst()->create($class);
}
// Define File Contents:
$file->setFromLocalFile($path, $filename);
// Write and Publish File:
$file->write();
$file->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
// Answer File ID:
return $file->ID;
}
}
|
[
"protected",
"function",
"processFile",
"(",
"DataObject",
"$",
"object",
",",
"$",
"field",
",",
"$",
"value",
",",
"$",
"class",
")",
"{",
"// Initialise:",
"$",
"source",
"=",
"null",
";",
"$",
"folder",
"=",
"null",
";",
"// Detect Value Type:",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"// Handle Array Value:",
"$",
"source",
"=",
"isset",
"(",
"$",
"value",
"[",
"'Source'",
"]",
")",
"?",
"$",
"value",
"[",
"'Source'",
"]",
":",
"null",
";",
"$",
"folder",
"=",
"isset",
"(",
"$",
"value",
"[",
"'Folder'",
"]",
")",
"?",
"$",
"value",
"[",
"'Folder'",
"]",
":",
"null",
";",
"}",
"else",
"{",
"// Handle String Value:",
"$",
"source",
"=",
"$",
"value",
";",
"}",
"// Obtain Folder (if required):",
"if",
"(",
"!",
"$",
"folder",
")",
"{",
"$",
"folder",
"=",
"$",
"this",
"->",
"getFolderName",
"(",
"$",
"object",
",",
"$",
"field",
")",
";",
"}",
"// Obtain Source Path:",
"$",
"path",
"=",
"Director",
"::",
"getAbsFile",
"(",
"$",
"source",
")",
";",
"// Does Source Exist?",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"// Obtain Base Name:",
"$",
"basename",
"=",
"basename",
"(",
"$",
"path",
")",
";",
"// Define Asset Filename:",
"$",
"filename",
"=",
"sprintf",
"(",
"'%s/%s'",
",",
"$",
"folder",
",",
"$",
"basename",
")",
";",
"// Obtain or Create File:",
"if",
"(",
"!",
"(",
"$",
"file",
"=",
"File",
"::",
"find",
"(",
"$",
"filename",
")",
")",
")",
"{",
"$",
"file",
"=",
"Injector",
"::",
"inst",
"(",
")",
"->",
"create",
"(",
"$",
"class",
")",
";",
"}",
"// Define File Contents:",
"$",
"file",
"->",
"setFromLocalFile",
"(",
"$",
"path",
",",
"$",
"filename",
")",
";",
"// Write and Publish File:",
"$",
"file",
"->",
"write",
"(",
")",
";",
"$",
"file",
"->",
"copyVersionToStage",
"(",
"Versioned",
"::",
"DRAFT",
",",
"Versioned",
"::",
"LIVE",
")",
";",
"// Answer File ID:",
"return",
"$",
"file",
"->",
"ID",
";",
"}",
"}"
] |
Processes the given value as a file and answers the ID of the file record.
@param DataObject $object
@param string $field
@param mixed $value
@param string $class
@return integer
|
[
"Processes",
"the",
"given",
"value",
"as",
"a",
"file",
"and",
"answers",
"the",
"ID",
"of",
"the",
"file",
"record",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1534-L1599
|
231,731
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.getFolderName
|
protected function getFolderName(DataObject $object, $field)
{
// Initialise:
$folder = null;
// Locate File Handle Field:
if ($fileField = $object->getCMSFields()->dataFieldByName($field)) {
if ($fileField instanceof FileHandleField) {
$folder = $fileField->getFolderName();
}
}
// Answer Folder Name:
return ($folder ? $folder : Upload::config()->uploads_folder);
}
|
php
|
protected function getFolderName(DataObject $object, $field)
{
// Initialise:
$folder = null;
// Locate File Handle Field:
if ($fileField = $object->getCMSFields()->dataFieldByName($field)) {
if ($fileField instanceof FileHandleField) {
$folder = $fileField->getFolderName();
}
}
// Answer Folder Name:
return ($folder ? $folder : Upload::config()->uploads_folder);
}
|
[
"protected",
"function",
"getFolderName",
"(",
"DataObject",
"$",
"object",
",",
"$",
"field",
")",
"{",
"// Initialise:",
"$",
"folder",
"=",
"null",
";",
"// Locate File Handle Field:",
"if",
"(",
"$",
"fileField",
"=",
"$",
"object",
"->",
"getCMSFields",
"(",
")",
"->",
"dataFieldByName",
"(",
"$",
"field",
")",
")",
"{",
"if",
"(",
"$",
"fileField",
"instanceof",
"FileHandleField",
")",
"{",
"$",
"folder",
"=",
"$",
"fileField",
"->",
"getFolderName",
"(",
")",
";",
"}",
"}",
"// Answer Folder Name:",
"return",
"(",
"$",
"folder",
"?",
"$",
"folder",
":",
"Upload",
"::",
"config",
"(",
")",
"->",
"uploads_folder",
")",
";",
"}"
] |
Attempts to answer the folder name for the given object and field name.
@param DataObject $object
@param string $field
@return string
|
[
"Attempts",
"to",
"answer",
"the",
"folder",
"name",
"for",
"the",
"given",
"object",
"and",
"field",
"name",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1609-L1628
|
231,732
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.processReference
|
protected function processReference($value)
{
if ($this->isReference($value)) {
list($class, $identifier) = $this->processTypedIdentifier($value);
if (!$this->getFactory()->hasFixture($class, $identifier)) {
throw new InvalidArgumentException(
sprintf(
'No fixture definition found for %s.%s',
$class,
$identifier
)
);
}
return $this->getFactory()->getFixture($class, $identifier);
}
}
|
php
|
protected function processReference($value)
{
if ($this->isReference($value)) {
list($class, $identifier) = $this->processTypedIdentifier($value);
if (!$this->getFactory()->hasFixture($class, $identifier)) {
throw new InvalidArgumentException(
sprintf(
'No fixture definition found for %s.%s',
$class,
$identifier
)
);
}
return $this->getFactory()->getFixture($class, $identifier);
}
}
|
[
"protected",
"function",
"processReference",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isReference",
"(",
"$",
"value",
")",
")",
"{",
"list",
"(",
"$",
"class",
",",
"$",
"identifier",
")",
"=",
"$",
"this",
"->",
"processTypedIdentifier",
"(",
"$",
"value",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"hasFixture",
"(",
"$",
"class",
",",
"$",
"identifier",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'No fixture definition found for %s.%s'",
",",
"$",
"class",
",",
"$",
"identifier",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"getFixture",
"(",
"$",
"class",
",",
"$",
"identifier",
")",
";",
"}",
"}"
] |
Processes the given reference string and answers the ID of the matching fixture.
@param string $value
@throws InvalidArgumentException
@return integer
|
[
"Processes",
"the",
"given",
"reference",
"string",
"and",
"answers",
"the",
"ID",
"of",
"the",
"matching",
"fixture",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1639-L1659
|
231,733
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.processChildIdentifier
|
protected function processChildIdentifier(DataObject $object, $name)
{
if ($this->isChildIdentifier($name)) {
$name = ltrim($name, '+');
if ($this->isTypedIdentifier($name)) {
return $this->processTypedIdentifier($name);
}
return [$object->defaultChild(), $name];
}
}
|
php
|
protected function processChildIdentifier(DataObject $object, $name)
{
if ($this->isChildIdentifier($name)) {
$name = ltrim($name, '+');
if ($this->isTypedIdentifier($name)) {
return $this->processTypedIdentifier($name);
}
return [$object->defaultChild(), $name];
}
}
|
[
"protected",
"function",
"processChildIdentifier",
"(",
"DataObject",
"$",
"object",
",",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isChildIdentifier",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"ltrim",
"(",
"$",
"name",
",",
"'+'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isTypedIdentifier",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"processTypedIdentifier",
"(",
"$",
"name",
")",
";",
"}",
"return",
"[",
"$",
"object",
"->",
"defaultChild",
"(",
")",
",",
"$",
"name",
"]",
";",
"}",
"}"
] |
Answers an array containing the class and name of the given child identifier.
@param DataObject $object
@param string $name
@return array
|
[
"Answers",
"an",
"array",
"containing",
"the",
"class",
"and",
"name",
"of",
"the",
"given",
"child",
"identifier",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1685-L1698
|
231,734
|
praxisnetau/silverware
|
src/Dev/FixtureBlueprint.php
|
FixtureBlueprint.prepareData
|
protected function prepareData(&$data)
{
// Remove MatchOn Filter:
$name = $this->getMatchOnName();
if (isset($data[$name])) {
unset($data[$name]);
}
}
|
php
|
protected function prepareData(&$data)
{
// Remove MatchOn Filter:
$name = $this->getMatchOnName();
if (isset($data[$name])) {
unset($data[$name]);
}
}
|
[
"protected",
"function",
"prepareData",
"(",
"&",
"$",
"data",
")",
"{",
"// Remove MatchOn Filter:",
"$",
"name",
"=",
"$",
"this",
"->",
"getMatchOnName",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"$",
"name",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"data",
"[",
"$",
"name",
"]",
")",
";",
"}",
"}"
] |
Prepares the given array of data for object population.
@param array $data
@return array
|
[
"Prepares",
"the",
"given",
"array",
"of",
"data",
"for",
"object",
"population",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureBlueprint.php#L1729-L1738
|
231,735
|
praxisnetau/silverware
|
src/Model/Template.php
|
Template.renderNotFound
|
public function renderNotFound($layout, $title, $type)
{
return ArrayData::create([
'Type' => $type,
'Title' => $title,
'Layout' => $layout
])->renderWith('Error\Includes\NotFound');
}
|
php
|
public function renderNotFound($layout, $title, $type)
{
return ArrayData::create([
'Type' => $type,
'Title' => $title,
'Layout' => $layout
])->renderWith('Error\Includes\NotFound');
}
|
[
"public",
"function",
"renderNotFound",
"(",
"$",
"layout",
",",
"$",
"title",
",",
"$",
"type",
")",
"{",
"return",
"ArrayData",
"::",
"create",
"(",
"[",
"'Type'",
"=>",
"$",
"type",
",",
"'Title'",
"=>",
"$",
"title",
",",
"'Layout'",
"=>",
"$",
"layout",
"]",
")",
"->",
"renderWith",
"(",
"'Error\\Includes\\NotFound'",
")",
";",
"}"
] |
Renders a 'not found' error for the HTML template.
@param string $layout Page layout passed from template.
@param string $title Page title passed from template.
@param string $type Type of item which was not found.
@return DBHTMLText
|
[
"Renders",
"a",
"not",
"found",
"error",
"for",
"the",
"HTML",
"template",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Template.php#L133-L140
|
231,736
|
praxisnetau/silverware
|
src/Extensions/PageExtension.php
|
PageExtension.updateStatusFlags
|
public function updateStatusFlags(&$flags)
{
if ($value = $this->owner->getNumberBadgeValue()) {
$text = sprintf($this->owner->getNumberBadgeText(), $value);
$flags['number-badge'] = ['text' => $text, 'title' => $text];
$flags['number-badge-value'] = ['text' => '', 'title' => $value];
}
}
|
php
|
public function updateStatusFlags(&$flags)
{
if ($value = $this->owner->getNumberBadgeValue()) {
$text = sprintf($this->owner->getNumberBadgeText(), $value);
$flags['number-badge'] = ['text' => $text, 'title' => $text];
$flags['number-badge-value'] = ['text' => '', 'title' => $value];
}
}
|
[
"public",
"function",
"updateStatusFlags",
"(",
"&",
"$",
"flags",
")",
"{",
"if",
"(",
"$",
"value",
"=",
"$",
"this",
"->",
"owner",
"->",
"getNumberBadgeValue",
"(",
")",
")",
"{",
"$",
"text",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"owner",
"->",
"getNumberBadgeText",
"(",
")",
",",
"$",
"value",
")",
";",
"$",
"flags",
"[",
"'number-badge'",
"]",
"=",
"[",
"'text'",
"=>",
"$",
"text",
",",
"'title'",
"=>",
"$",
"text",
"]",
";",
"$",
"flags",
"[",
"'number-badge-value'",
"]",
"=",
"[",
"'text'",
"=>",
"''",
",",
"'title'",
"=>",
"$",
"value",
"]",
";",
"}",
"}"
] |
Updates the status flags of the extended object.
@param array $flags
@return void
|
[
"Updates",
"the",
"status",
"flags",
"of",
"the",
"extended",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/PageExtension.php#L174-L184
|
231,737
|
praxisnetau/silverware
|
src/Extensions/PageExtension.php
|
PageExtension.getPageLayout
|
public function getPageLayout()
{
// Obtain Page Layout:
if ($this->hasPageLayout()) {
$layout = $this->owner->MyLayout();
} else {
$layout = $this->getDefaultLayout();
}
// Answer Page Layout (if available and enabled):
if ($layout && $layout->isEnabled()) {
return $layout;
}
}
|
php
|
public function getPageLayout()
{
// Obtain Page Layout:
if ($this->hasPageLayout()) {
$layout = $this->owner->MyLayout();
} else {
$layout = $this->getDefaultLayout();
}
// Answer Page Layout (if available and enabled):
if ($layout && $layout->isEnabled()) {
return $layout;
}
}
|
[
"public",
"function",
"getPageLayout",
"(",
")",
"{",
"// Obtain Page Layout:",
"if",
"(",
"$",
"this",
"->",
"hasPageLayout",
"(",
")",
")",
"{",
"$",
"layout",
"=",
"$",
"this",
"->",
"owner",
"->",
"MyLayout",
"(",
")",
";",
"}",
"else",
"{",
"$",
"layout",
"=",
"$",
"this",
"->",
"getDefaultLayout",
"(",
")",
";",
"}",
"// Answer Page Layout (if available and enabled):",
"if",
"(",
"$",
"layout",
"&&",
"$",
"layout",
"->",
"isEnabled",
"(",
")",
")",
"{",
"return",
"$",
"layout",
";",
"}",
"}"
] |
Answers the layout defined for the extended object.
@return Layout
|
[
"Answers",
"the",
"layout",
"defined",
"for",
"the",
"extended",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/PageExtension.php#L262-L277
|
231,738
|
praxisnetau/silverware
|
src/Extensions/PageExtension.php
|
PageExtension.getPageTemplate
|
public function getPageTemplate()
{
// Obtain Page Template:
if ($this->hasPageTemplate()) {
$template = $this->owner->MyTemplate();
} else {
$template = $this->getDefaultTemplate();
}
// Answer Page Template (if available and enabled):
if ($template && $template->isEnabled()) {
return $template;
}
}
|
php
|
public function getPageTemplate()
{
// Obtain Page Template:
if ($this->hasPageTemplate()) {
$template = $this->owner->MyTemplate();
} else {
$template = $this->getDefaultTemplate();
}
// Answer Page Template (if available and enabled):
if ($template && $template->isEnabled()) {
return $template;
}
}
|
[
"public",
"function",
"getPageTemplate",
"(",
")",
"{",
"// Obtain Page Template:",
"if",
"(",
"$",
"this",
"->",
"hasPageTemplate",
"(",
")",
")",
"{",
"$",
"template",
"=",
"$",
"this",
"->",
"owner",
"->",
"MyTemplate",
"(",
")",
";",
"}",
"else",
"{",
"$",
"template",
"=",
"$",
"this",
"->",
"getDefaultTemplate",
"(",
")",
";",
"}",
"// Answer Page Template (if available and enabled):",
"if",
"(",
"$",
"template",
"&&",
"$",
"template",
"->",
"isEnabled",
"(",
")",
")",
"{",
"return",
"$",
"template",
";",
"}",
"}"
] |
Answers the template defined for the extended object.
@return Template
|
[
"Answers",
"the",
"template",
"defined",
"for",
"the",
"extended",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/PageExtension.php#L304-L319
|
231,739
|
praxisnetau/silverware
|
src/Extensions/PageExtension.php
|
PageExtension.getEnabledComponents
|
public function getEnabledComponents()
{
// Create Components List:
$components = ArrayList::create();
// Merge Template Components:
if ($template = $this->getPageTemplate()) {
$components->merge($template->getEnabledComponents());
}
// Merge Layout Components:
if ($layout = $this->getPageLayout()) {
$components->merge($layout->getEnabledComponents());
}
// Answer Components List:
return $components;
}
|
php
|
public function getEnabledComponents()
{
// Create Components List:
$components = ArrayList::create();
// Merge Template Components:
if ($template = $this->getPageTemplate()) {
$components->merge($template->getEnabledComponents());
}
// Merge Layout Components:
if ($layout = $this->getPageLayout()) {
$components->merge($layout->getEnabledComponents());
}
// Answer Components List:
return $components;
}
|
[
"public",
"function",
"getEnabledComponents",
"(",
")",
"{",
"// Create Components List:",
"$",
"components",
"=",
"ArrayList",
"::",
"create",
"(",
")",
";",
"// Merge Template Components:",
"if",
"(",
"$",
"template",
"=",
"$",
"this",
"->",
"getPageTemplate",
"(",
")",
")",
"{",
"$",
"components",
"->",
"merge",
"(",
"$",
"template",
"->",
"getEnabledComponents",
"(",
")",
")",
";",
"}",
"// Merge Layout Components:",
"if",
"(",
"$",
"layout",
"=",
"$",
"this",
"->",
"getPageLayout",
"(",
")",
")",
"{",
"$",
"components",
"->",
"merge",
"(",
"$",
"layout",
"->",
"getEnabledComponents",
"(",
")",
")",
";",
"}",
"// Answer Components List:",
"return",
"$",
"components",
";",
"}"
] |
Answers a list of the enabled components within the extended object.
@return ArrayList
|
[
"Answers",
"a",
"list",
"of",
"the",
"enabled",
"components",
"within",
"the",
"extended",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/PageExtension.php#L380-L401
|
231,740
|
praxisnetau/silverware
|
src/Extensions/PageExtension.php
|
PageExtension.getFieldFromHierarchy
|
public function getFieldFromHierarchy($name)
{
return !is_null($this->owner->$name) ? $this->owner->$name : $this->owner->getFieldFromParent($name);
}
|
php
|
public function getFieldFromHierarchy($name)
{
return !is_null($this->owner->$name) ? $this->owner->$name : $this->owner->getFieldFromParent($name);
}
|
[
"public",
"function",
"getFieldFromHierarchy",
"(",
"$",
"name",
")",
"{",
"return",
"!",
"is_null",
"(",
"$",
"this",
"->",
"owner",
"->",
"$",
"name",
")",
"?",
"$",
"this",
"->",
"owner",
"->",
"$",
"name",
":",
"$",
"this",
"->",
"owner",
"->",
"getFieldFromParent",
"(",
"$",
"name",
")",
";",
"}"
] |
Answers the value of the specified attribute from the extended object or an ancestor.
@param string $name
@return mixed
|
[
"Answers",
"the",
"value",
"of",
"the",
"specified",
"attribute",
"from",
"the",
"extended",
"object",
"or",
"an",
"ancestor",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/PageExtension.php#L420-L423
|
231,741
|
praxisnetau/silverware
|
src/Model/Link.php
|
Link.getIconSizeClass
|
public function getIconSizeClass()
{
$size = $this->config()->default_icon_size;
if (($parent = $this->getParent()) && $parent->IconSize) {
$size = $parent->IconSize;
}
return sprintf('size-%d', $size);
}
|
php
|
public function getIconSizeClass()
{
$size = $this->config()->default_icon_size;
if (($parent = $this->getParent()) && $parent->IconSize) {
$size = $parent->IconSize;
}
return sprintf('size-%d', $size);
}
|
[
"public",
"function",
"getIconSizeClass",
"(",
")",
"{",
"$",
"size",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"default_icon_size",
";",
"if",
"(",
"(",
"$",
"parent",
"=",
"$",
"this",
"->",
"getParent",
"(",
")",
")",
"&&",
"$",
"parent",
"->",
"IconSize",
")",
"{",
"$",
"size",
"=",
"$",
"parent",
"->",
"IconSize",
";",
"}",
"return",
"sprintf",
"(",
"'size-%d'",
",",
"$",
"size",
")",
";",
"}"
] |
Answers the icon size class for the receiver.
@return string
|
[
"Answers",
"the",
"icon",
"size",
"class",
"for",
"the",
"receiver",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Link.php#L336-L345
|
231,742
|
praxisnetau/silverware
|
src/Model/Link.php
|
Link.fromPage
|
public function fromPage(Page $page, $nameField = 'MenuTitle')
{
$this->Title = $page->{$nameField};
$this->LinkTo = LinkToExtension::MODE_PAGE;
$this->LinkPageID = $page->ID;
return $this;
}
|
php
|
public function fromPage(Page $page, $nameField = 'MenuTitle')
{
$this->Title = $page->{$nameField};
$this->LinkTo = LinkToExtension::MODE_PAGE;
$this->LinkPageID = $page->ID;
return $this;
}
|
[
"public",
"function",
"fromPage",
"(",
"Page",
"$",
"page",
",",
"$",
"nameField",
"=",
"'MenuTitle'",
")",
"{",
"$",
"this",
"->",
"Title",
"=",
"$",
"page",
"->",
"{",
"$",
"nameField",
"}",
";",
"$",
"this",
"->",
"LinkTo",
"=",
"LinkToExtension",
"::",
"MODE_PAGE",
";",
"$",
"this",
"->",
"LinkPageID",
"=",
"$",
"page",
"->",
"ID",
";",
"return",
"$",
"this",
";",
"}"
] |
Defines the receiver from the given page.
@param Page $page
@param string $nameField
@return $this
|
[
"Defines",
"the",
"receiver",
"from",
"the",
"given",
"page",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Link.php#L454-L461
|
231,743
|
praxisnetau/silverware
|
src/Model/Link.php
|
Link.getCustomCSSPrefix
|
public function getCustomCSSPrefix()
{
if ($parent = $this->getParent()) {
return sprintf('%s %s', $parent->CSSID, $this->CSSID);
}
return $this->CSSID;
}
|
php
|
public function getCustomCSSPrefix()
{
if ($parent = $this->getParent()) {
return sprintf('%s %s', $parent->CSSID, $this->CSSID);
}
return $this->CSSID;
}
|
[
"public",
"function",
"getCustomCSSPrefix",
"(",
")",
"{",
"if",
"(",
"$",
"parent",
"=",
"$",
"this",
"->",
"getParent",
"(",
")",
")",
"{",
"return",
"sprintf",
"(",
"'%s %s'",
",",
"$",
"parent",
"->",
"CSSID",
",",
"$",
"this",
"->",
"CSSID",
")",
";",
"}",
"return",
"$",
"this",
"->",
"CSSID",
";",
"}"
] |
Answers the CSS prefix used for the custom CSS template.
@return string
|
[
"Answers",
"the",
"CSS",
"prefix",
"used",
"for",
"the",
"custom",
"CSS",
"template",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Link.php#L468-L475
|
231,744
|
digiaonline/paytrail-php
|
src/Object/Contact.php
|
Contact.toArray
|
public function toArray()
{
$array = array(
'firstName' => $this->firstName,
'lastName' => $this->lastName,
'email' => $this->email,
'telephone' => $this->phoneNumber,
'mobile' => $this->mobileNumber,
'companyName' => $this->companyName,
);
if ($this->address !== null) {
$array['address'] = $this->address->toArray();
}
return $array;
}
|
php
|
public function toArray()
{
$array = array(
'firstName' => $this->firstName,
'lastName' => $this->lastName,
'email' => $this->email,
'telephone' => $this->phoneNumber,
'mobile' => $this->mobileNumber,
'companyName' => $this->companyName,
);
if ($this->address !== null) {
$array['address'] = $this->address->toArray();
}
return $array;
}
|
[
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"array",
"=",
"array",
"(",
"'firstName'",
"=>",
"$",
"this",
"->",
"firstName",
",",
"'lastName'",
"=>",
"$",
"this",
"->",
"lastName",
",",
"'email'",
"=>",
"$",
"this",
"->",
"email",
",",
"'telephone'",
"=>",
"$",
"this",
"->",
"phoneNumber",
",",
"'mobile'",
"=>",
"$",
"this",
"->",
"mobileNumber",
",",
"'companyName'",
"=>",
"$",
"this",
"->",
"companyName",
",",
")",
";",
"if",
"(",
"$",
"this",
"->",
"address",
"!==",
"null",
")",
"{",
"$",
"array",
"[",
"'address'",
"]",
"=",
"$",
"this",
"->",
"address",
"->",
"toArray",
"(",
")",
";",
"}",
"return",
"$",
"array",
";",
"}"
] |
Convert properties to array.
@return array The
|
[
"Convert",
"properties",
"to",
"array",
"."
] |
a49c5e6742c42907fe329ff9b070fe7b21add74a
|
https://github.com/digiaonline/paytrail-php/blob/a49c5e6742c42907fe329ff9b070fe7b21add74a/src/Object/Contact.php#L63-L78
|
231,745
|
i-am-tom/schemer
|
src/Validator/Assoc.php
|
Assoc.length
|
public function length(int $entries) : Assoc
{
return $this->pipe(
self::predicate(
function (array $assoc) use ($entries) : bool {
return count($assoc) === $entries;
},
'doesn\'t have exactly ' . self::entryf($entries)
)
);
}
|
php
|
public function length(int $entries) : Assoc
{
return $this->pipe(
self::predicate(
function (array $assoc) use ($entries) : bool {
return count($assoc) === $entries;
},
'doesn\'t have exactly ' . self::entryf($entries)
)
);
}
|
[
"public",
"function",
"length",
"(",
"int",
"$",
"entries",
")",
":",
"Assoc",
"{",
"return",
"$",
"this",
"->",
"pipe",
"(",
"self",
"::",
"predicate",
"(",
"function",
"(",
"array",
"$",
"assoc",
")",
"use",
"(",
"$",
"entries",
")",
":",
"bool",
"{",
"return",
"count",
"(",
"$",
"assoc",
")",
"===",
"$",
"entries",
";",
"}",
",",
"'doesn\\'t have exactly '",
".",
"self",
"::",
"entryf",
"(",
"$",
"entries",
")",
")",
")",
";",
"}"
] |
The associative array must have exactly a given number of entries.
@param int $entries The number of keys allowed.
@return Schemer\Validator\Assoc
|
[
"The",
"associative",
"array",
"must",
"have",
"exactly",
"a",
"given",
"number",
"of",
"entries",
"."
] |
aa4ff458eae636ca61ada07d05859e27d3b4584d
|
https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Validator/Assoc.php#L50-L60
|
231,746
|
i-am-tom/schemer
|
src/Validator/Assoc.php
|
Assoc.max
|
public function max(int $entries) : Assoc
{
return $this->pipe(
self::predicate(
function (array $values) use ($entries) : bool {
return count($values) <= $entries;
},
'has over ' . self::entryf($entries)
)
);
}
|
php
|
public function max(int $entries) : Assoc
{
return $this->pipe(
self::predicate(
function (array $values) use ($entries) : bool {
return count($values) <= $entries;
},
'has over ' . self::entryf($entries)
)
);
}
|
[
"public",
"function",
"max",
"(",
"int",
"$",
"entries",
")",
":",
"Assoc",
"{",
"return",
"$",
"this",
"->",
"pipe",
"(",
"self",
"::",
"predicate",
"(",
"function",
"(",
"array",
"$",
"values",
")",
"use",
"(",
"$",
"entries",
")",
":",
"bool",
"{",
"return",
"count",
"(",
"$",
"values",
")",
"<=",
"$",
"entries",
";",
"}",
",",
"'has over '",
".",
"self",
"::",
"entryf",
"(",
"$",
"entries",
")",
")",
")",
";",
"}"
] |
The associative array must have at most a given number of entries.
@param int $entries The maximum number of keys allowed.
@return Schemer\Validator\Assoc
|
[
"The",
"associative",
"array",
"must",
"have",
"at",
"most",
"a",
"given",
"number",
"of",
"entries",
"."
] |
aa4ff458eae636ca61ada07d05859e27d3b4584d
|
https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Validator/Assoc.php#L67-L77
|
231,747
|
i-am-tom/schemer
|
src/Validator/Assoc.php
|
Assoc.never
|
public function never(array $keys) : Assoc
{
return $this->pipe(function (array $values) use ($keys) : Result {
$result = Result::success();
foreach ($keys as $key) {
if (!isset($values[$key])) {
continue;
}
$result = $result->concat(
Result::failure("contains '$key'")
);
}
return $result;
});
}
|
php
|
public function never(array $keys) : Assoc
{
return $this->pipe(function (array $values) use ($keys) : Result {
$result = Result::success();
foreach ($keys as $key) {
if (!isset($values[$key])) {
continue;
}
$result = $result->concat(
Result::failure("contains '$key'")
);
}
return $result;
});
}
|
[
"public",
"function",
"never",
"(",
"array",
"$",
"keys",
")",
":",
"Assoc",
"{",
"return",
"$",
"this",
"->",
"pipe",
"(",
"function",
"(",
"array",
"$",
"values",
")",
"use",
"(",
"$",
"keys",
")",
":",
"Result",
"{",
"$",
"result",
"=",
"Result",
"::",
"success",
"(",
")",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"values",
"[",
"$",
"key",
"]",
")",
")",
"{",
"continue",
";",
"}",
"$",
"result",
"=",
"$",
"result",
"->",
"concat",
"(",
"Result",
"::",
"failure",
"(",
"\"contains '$key'\"",
")",
")",
";",
"}",
"return",
"$",
"result",
";",
"}",
")",
";",
"}"
] |
The associative array may never contain the following keys.
@param array $keys The optional schema.
@return Schemer\Validator\Assoc
|
[
"The",
"associative",
"array",
"may",
"never",
"contain",
"the",
"following",
"keys",
"."
] |
aa4ff458eae636ca61ada07d05859e27d3b4584d
|
https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Validator/Assoc.php#L101-L118
|
231,748
|
i-am-tom/schemer
|
src/Validator/Assoc.php
|
Assoc.only
|
public function only(array $keys)
{
return $this->pipe(function ($values) use ($keys) {
$result = Result::success();
foreach ($values as $key => $_) {
if (in_array($key, $keys)) {
continue;
}
return $result->concat(
Result::failure("contains '$key'")
);
}
return $result;
});
}
|
php
|
public function only(array $keys)
{
return $this->pipe(function ($values) use ($keys) {
$result = Result::success();
foreach ($values as $key => $_) {
if (in_array($key, $keys)) {
continue;
}
return $result->concat(
Result::failure("contains '$key'")
);
}
return $result;
});
}
|
[
"public",
"function",
"only",
"(",
"array",
"$",
"keys",
")",
"{",
"return",
"$",
"this",
"->",
"pipe",
"(",
"function",
"(",
"$",
"values",
")",
"use",
"(",
"$",
"keys",
")",
"{",
"$",
"result",
"=",
"Result",
"::",
"success",
"(",
")",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"key",
"=>",
"$",
"_",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"key",
",",
"$",
"keys",
")",
")",
"{",
"continue",
";",
"}",
"return",
"$",
"result",
"->",
"concat",
"(",
"Result",
"::",
"failure",
"(",
"\"contains '$key'\"",
")",
")",
";",
"}",
"return",
"$",
"result",
";",
"}",
")",
";",
"}"
] |
The associative array may only contain the following keys.
@param array $keys The optional schema.
@return Schemer\Validator\Assoc
|
[
"The",
"associative",
"array",
"may",
"only",
"contain",
"the",
"following",
"keys",
"."
] |
aa4ff458eae636ca61ada07d05859e27d3b4584d
|
https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Validator/Assoc.php#L125-L142
|
231,749
|
i-am-tom/schemer
|
src/Validator/Assoc.php
|
Assoc.optional
|
public function optional(array $schema) : Assoc
{
return $this->pipe(function (array $values) use ($schema) : Result {
$result = Result::success();
foreach ($schema as $key => $validator) {
if (!isset($values[$key])) {
continue;
}
$result = $result->concat(
$validator
->validate($values[$key])
->map(function ($error) use ($key) {
return "$key: $error";
})
);
}
return $result;
});
}
|
php
|
public function optional(array $schema) : Assoc
{
return $this->pipe(function (array $values) use ($schema) : Result {
$result = Result::success();
foreach ($schema as $key => $validator) {
if (!isset($values[$key])) {
continue;
}
$result = $result->concat(
$validator
->validate($values[$key])
->map(function ($error) use ($key) {
return "$key: $error";
})
);
}
return $result;
});
}
|
[
"public",
"function",
"optional",
"(",
"array",
"$",
"schema",
")",
":",
"Assoc",
"{",
"return",
"$",
"this",
"->",
"pipe",
"(",
"function",
"(",
"array",
"$",
"values",
")",
"use",
"(",
"$",
"schema",
")",
":",
"Result",
"{",
"$",
"result",
"=",
"Result",
"::",
"success",
"(",
")",
";",
"foreach",
"(",
"$",
"schema",
"as",
"$",
"key",
"=>",
"$",
"validator",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"values",
"[",
"$",
"key",
"]",
")",
")",
"{",
"continue",
";",
"}",
"$",
"result",
"=",
"$",
"result",
"->",
"concat",
"(",
"$",
"validator",
"->",
"validate",
"(",
"$",
"values",
"[",
"$",
"key",
"]",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"error",
")",
"use",
"(",
"$",
"key",
")",
"{",
"return",
"\"$key: $error\"",
";",
"}",
")",
")",
";",
"}",
"return",
"$",
"result",
";",
"}",
")",
";",
"}"
] |
The associative array may contain the given values.
@param array $schema The optional schema.
@return Schemer\Validator\Assoc
|
[
"The",
"associative",
"array",
"may",
"contain",
"the",
"given",
"values",
"."
] |
aa4ff458eae636ca61ada07d05859e27d3b4584d
|
https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Validator/Assoc.php#L149-L170
|
231,750
|
praxisnetau/silverware
|
src/Grid/Frameworks/Bootstrap/Section.php
|
Section.getClassNamesForContainer
|
public function getClassNamesForContainer()
{
$classes = [$this->owner->isFullWidth() ? 'container-fluid' : 'container'];
if ($this->owner->isEdgeToEdge()) {
$classes[] = $this->style('section.edge-to-edge');
}
return $classes;
}
|
php
|
public function getClassNamesForContainer()
{
$classes = [$this->owner->isFullWidth() ? 'container-fluid' : 'container'];
if ($this->owner->isEdgeToEdge()) {
$classes[] = $this->style('section.edge-to-edge');
}
return $classes;
}
|
[
"public",
"function",
"getClassNamesForContainer",
"(",
")",
"{",
"$",
"classes",
"=",
"[",
"$",
"this",
"->",
"owner",
"->",
"isFullWidth",
"(",
")",
"?",
"'container-fluid'",
":",
"'container'",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"isEdgeToEdge",
"(",
")",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"$",
"this",
"->",
"style",
"(",
"'section.edge-to-edge'",
")",
";",
"}",
"return",
"$",
"classes",
";",
"}"
] |
Answers the container class names for the extended object.
@return array
|
[
"Answers",
"the",
"container",
"class",
"names",
"for",
"the",
"extended",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Grid/Frameworks/Bootstrap/Section.php#L52-L61
|
231,751
|
praxisnetau/silverware
|
src/Lists/ListAlert.php
|
ListAlert.getListAlertsData
|
public function getListAlertsData()
{
$alerts = ArrayList::create();
foreach ($this->getListAlerts() as $alert) {
$alerts->push(ArrayData::create($alert));
}
return $alerts;
}
|
php
|
public function getListAlertsData()
{
$alerts = ArrayList::create();
foreach ($this->getListAlerts() as $alert) {
$alerts->push(ArrayData::create($alert));
}
return $alerts;
}
|
[
"public",
"function",
"getListAlertsData",
"(",
")",
"{",
"$",
"alerts",
"=",
"ArrayList",
"::",
"create",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getListAlerts",
"(",
")",
"as",
"$",
"alert",
")",
"{",
"$",
"alerts",
"->",
"push",
"(",
"ArrayData",
"::",
"create",
"(",
"$",
"alert",
")",
")",
";",
"}",
"return",
"$",
"alerts",
";",
"}"
] |
Answers an array list of alerts for the template.
@return ArrayList
|
[
"Answers",
"an",
"array",
"list",
"of",
"alerts",
"for",
"the",
"template",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Lists/ListAlert.php#L70-L79
|
231,752
|
praxisnetau/silverware
|
src/Lists/ListAlert.php
|
ListAlert.addListAlert
|
public function addListAlert($text, $type = 'primary', $icon = 'info-circle')
{
$this->listAlerts[] = [
'Text' => $text,
'Type' => $type,
'Icon' => $icon
];
return $this;
}
|
php
|
public function addListAlert($text, $type = 'primary', $icon = 'info-circle')
{
$this->listAlerts[] = [
'Text' => $text,
'Type' => $type,
'Icon' => $icon
];
return $this;
}
|
[
"public",
"function",
"addListAlert",
"(",
"$",
"text",
",",
"$",
"type",
"=",
"'primary'",
",",
"$",
"icon",
"=",
"'info-circle'",
")",
"{",
"$",
"this",
"->",
"listAlerts",
"[",
"]",
"=",
"[",
"'Text'",
"=>",
"$",
"text",
",",
"'Type'",
"=>",
"$",
"type",
",",
"'Icon'",
"=>",
"$",
"icon",
"]",
";",
"return",
"$",
"this",
";",
"}"
] |
Adds an alert with the given details to the array of alerts.
@param string $text
@param string $type
@param string $icon
@return $this
|
[
"Adds",
"an",
"alert",
"with",
"the",
"given",
"details",
"to",
"the",
"array",
"of",
"alerts",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Lists/ListAlert.php#L90-L99
|
231,753
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaFieldConfig
|
public function getMetaFieldConfig()
{
// Obtain Default Config:
$config = Config::inst()->get(self::class, 'default_meta_fields');
// Merge Owner Config:
if (is_array($this->owner->config()->meta_fields)) {
$config = array_merge($config, $this->owner->config()->meta_fields);
}
// Answer Config:
return $config;
}
|
php
|
public function getMetaFieldConfig()
{
// Obtain Default Config:
$config = Config::inst()->get(self::class, 'default_meta_fields');
// Merge Owner Config:
if (is_array($this->owner->config()->meta_fields)) {
$config = array_merge($config, $this->owner->config()->meta_fields);
}
// Answer Config:
return $config;
}
|
[
"public",
"function",
"getMetaFieldConfig",
"(",
")",
"{",
"// Obtain Default Config:",
"$",
"config",
"=",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"self",
"::",
"class",
",",
"'default_meta_fields'",
")",
";",
"// Merge Owner Config:",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"owner",
"->",
"config",
"(",
")",
"->",
"meta_fields",
")",
")",
"{",
"$",
"config",
"=",
"array_merge",
"(",
"$",
"config",
",",
"$",
"this",
"->",
"owner",
"->",
"config",
"(",
")",
"->",
"meta_fields",
")",
";",
"}",
"// Answer Config:",
"return",
"$",
"config",
";",
"}"
] |
Answers the meta field configuration from the extended object.
@return array
|
[
"Answers",
"the",
"meta",
"field",
"configuration",
"from",
"the",
"extended",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L251-L266
|
231,754
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaSummaryFields
|
public function getMetaSummaryFields($params = [])
{
// Define Placeholder:
$placeholder = _t(__CLASS__ . '.DROPDOWNDEFAULT', '(default)');
// Create Field Objects:
$fields = [
HTMLEditorField::create(
'SummaryMeta',
$this->owner->fieldLabel('SummaryMeta')
)->setRows(10),
$mode = DropdownField::create(
'SummaryMode',
$this->owner->fieldLabel('SummaryMode'),
$this->getSummaryModeOptions()
)->setEmptyString(' ')->setAttribute('data-placeholder', $placeholder)
];
// Define Mode Right Title:
$mode->setRightTitle(
_t(
__CLASS__ . '.SUMMARYMODERIGHTTITLE',
'This mode only applies to summary text automatically generated from the record content.'
)
);
// Answer Field Objects:
return FieldList::create([
FieldSection::create(
'SummaryMetaSection',
$this->owner->fieldLabel('SummaryMetaSection'),
$fields
)
]);
}
|
php
|
public function getMetaSummaryFields($params = [])
{
// Define Placeholder:
$placeholder = _t(__CLASS__ . '.DROPDOWNDEFAULT', '(default)');
// Create Field Objects:
$fields = [
HTMLEditorField::create(
'SummaryMeta',
$this->owner->fieldLabel('SummaryMeta')
)->setRows(10),
$mode = DropdownField::create(
'SummaryMode',
$this->owner->fieldLabel('SummaryMode'),
$this->getSummaryModeOptions()
)->setEmptyString(' ')->setAttribute('data-placeholder', $placeholder)
];
// Define Mode Right Title:
$mode->setRightTitle(
_t(
__CLASS__ . '.SUMMARYMODERIGHTTITLE',
'This mode only applies to summary text automatically generated from the record content.'
)
);
// Answer Field Objects:
return FieldList::create([
FieldSection::create(
'SummaryMetaSection',
$this->owner->fieldLabel('SummaryMetaSection'),
$fields
)
]);
}
|
[
"public",
"function",
"getMetaSummaryFields",
"(",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"// Define Placeholder:",
"$",
"placeholder",
"=",
"_t",
"(",
"__CLASS__",
".",
"'.DROPDOWNDEFAULT'",
",",
"'(default)'",
")",
";",
"// Create Field Objects:",
"$",
"fields",
"=",
"[",
"HTMLEditorField",
"::",
"create",
"(",
"'SummaryMeta'",
",",
"$",
"this",
"->",
"owner",
"->",
"fieldLabel",
"(",
"'SummaryMeta'",
")",
")",
"->",
"setRows",
"(",
"10",
")",
",",
"$",
"mode",
"=",
"DropdownField",
"::",
"create",
"(",
"'SummaryMode'",
",",
"$",
"this",
"->",
"owner",
"->",
"fieldLabel",
"(",
"'SummaryMode'",
")",
",",
"$",
"this",
"->",
"getSummaryModeOptions",
"(",
")",
")",
"->",
"setEmptyString",
"(",
"' '",
")",
"->",
"setAttribute",
"(",
"'data-placeholder'",
",",
"$",
"placeholder",
")",
"]",
";",
"// Define Mode Right Title:",
"$",
"mode",
"->",
"setRightTitle",
"(",
"_t",
"(",
"__CLASS__",
".",
"'.SUMMARYMODERIGHTTITLE'",
",",
"'This mode only applies to summary text automatically generated from the record content.'",
")",
")",
";",
"// Answer Field Objects:",
"return",
"FieldList",
"::",
"create",
"(",
"[",
"FieldSection",
"::",
"create",
"(",
"'SummaryMetaSection'",
",",
"$",
"this",
"->",
"owner",
"->",
"fieldLabel",
"(",
"'SummaryMetaSection'",
")",
",",
"$",
"fields",
")",
"]",
")",
";",
"}"
] |
Answers a list of fields for the meta summary.
@param array $params
@return FieldList
|
[
"Answers",
"a",
"list",
"of",
"fields",
"for",
"the",
"meta",
"summary",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L275-L313
|
231,755
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaLink
|
public function getMetaLink()
{
if ($this->owner->hasMethod('Link')) {
return $this->owner->Link();
} elseif ($this->owner->Link) {
return $this->owner->Link;
}
}
|
php
|
public function getMetaLink()
{
if ($this->owner->hasMethod('Link')) {
return $this->owner->Link();
} elseif ($this->owner->Link) {
return $this->owner->Link;
}
}
|
[
"public",
"function",
"getMetaLink",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"hasMethod",
"(",
"'Link'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"Link",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"owner",
"->",
"Link",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"Link",
";",
"}",
"}"
] |
Answers the link for the extended object.
@return string
|
[
"Answers",
"the",
"link",
"for",
"the",
"extended",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L476-L483
|
231,756
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaAbsoluteLink
|
public function getMetaAbsoluteLink()
{
if ($this->owner->hasMethod('AbsoluteLink')) {
return $this->owner->AbsoluteLink();
} elseif ($this->owner->AbsoluteLink) {
return $this->owner->AbsoluteLink;
}
}
|
php
|
public function getMetaAbsoluteLink()
{
if ($this->owner->hasMethod('AbsoluteLink')) {
return $this->owner->AbsoluteLink();
} elseif ($this->owner->AbsoluteLink) {
return $this->owner->AbsoluteLink;
}
}
|
[
"public",
"function",
"getMetaAbsoluteLink",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"hasMethod",
"(",
"'AbsoluteLink'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"AbsoluteLink",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"owner",
"->",
"AbsoluteLink",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"AbsoluteLink",
";",
"}",
"}"
] |
Answers the absolute link for the extended object.
@return string
|
[
"Answers",
"the",
"absolute",
"link",
"for",
"the",
"extended",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L500-L507
|
231,757
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaDateFormat
|
public function getMetaDateFormat()
{
if ($format = $this->owner->config()->meta_date_format) {
return $format;
}
return Config::inst()->get(self::class, 'default_meta_date_format');
}
|
php
|
public function getMetaDateFormat()
{
if ($format = $this->owner->config()->meta_date_format) {
return $format;
}
return Config::inst()->get(self::class, 'default_meta_date_format');
}
|
[
"public",
"function",
"getMetaDateFormat",
"(",
")",
"{",
"if",
"(",
"$",
"format",
"=",
"$",
"this",
"->",
"owner",
"->",
"config",
"(",
")",
"->",
"meta_date_format",
")",
"{",
"return",
"$",
"format",
";",
"}",
"return",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"self",
"::",
"class",
",",
"'default_meta_date_format'",
")",
";",
"}"
] |
Answers the format for the date of the extended object.
@return string
|
[
"Answers",
"the",
"format",
"for",
"the",
"date",
"of",
"the",
"extended",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L534-L541
|
231,758
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaDateFormatted
|
public function getMetaDateFormatted($format = null)
{
if ($this->owner->hasMetaDate()) {
return $this->owner->getMetaDate()->Format($format ? $format : $this->owner->getMetaDateFormat());
}
}
|
php
|
public function getMetaDateFormatted($format = null)
{
if ($this->owner->hasMetaDate()) {
return $this->owner->getMetaDate()->Format($format ? $format : $this->owner->getMetaDateFormat());
}
}
|
[
"public",
"function",
"getMetaDateFormatted",
"(",
"$",
"format",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"hasMetaDate",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"getMetaDate",
"(",
")",
"->",
"Format",
"(",
"$",
"format",
"?",
"$",
"format",
":",
"$",
"this",
"->",
"owner",
"->",
"getMetaDateFormat",
"(",
")",
")",
";",
"}",
"}"
] |
Formats the date of the extended object using the given format, or a default format.
@param string $format
@return string
|
[
"Formats",
"the",
"date",
"of",
"the",
"extended",
"object",
"using",
"the",
"given",
"format",
"or",
"a",
"default",
"format",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L550-L555
|
231,759
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaSummary
|
public function getMetaSummary()
{
$summary = '';
if ($this->owner->SummaryMeta) {
$summary = $this->owner->SummaryMeta;
} elseif ($this->owner->hasField('Summary') && $this->owner->Summary) {
$summary = $this->owner->Summary;
} elseif ($content = $this->owner->getMetaContent()) {
$summary = sprintf('<p>%s</p>', $this->owner->getContentSummary($content));
}
return DBField::create_field('HTMLFragment', $summary)->setProcessShortcodes(true);
}
|
php
|
public function getMetaSummary()
{
$summary = '';
if ($this->owner->SummaryMeta) {
$summary = $this->owner->SummaryMeta;
} elseif ($this->owner->hasField('Summary') && $this->owner->Summary) {
$summary = $this->owner->Summary;
} elseif ($content = $this->owner->getMetaContent()) {
$summary = sprintf('<p>%s</p>', $this->owner->getContentSummary($content));
}
return DBField::create_field('HTMLFragment', $summary)->setProcessShortcodes(true);
}
|
[
"public",
"function",
"getMetaSummary",
"(",
")",
"{",
"$",
"summary",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"SummaryMeta",
")",
"{",
"$",
"summary",
"=",
"$",
"this",
"->",
"owner",
"->",
"SummaryMeta",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"owner",
"->",
"hasField",
"(",
"'Summary'",
")",
"&&",
"$",
"this",
"->",
"owner",
"->",
"Summary",
")",
"{",
"$",
"summary",
"=",
"$",
"this",
"->",
"owner",
"->",
"Summary",
";",
"}",
"elseif",
"(",
"$",
"content",
"=",
"$",
"this",
"->",
"owner",
"->",
"getMetaContent",
"(",
")",
")",
"{",
"$",
"summary",
"=",
"sprintf",
"(",
"'<p>%s</p>'",
",",
"$",
"this",
"->",
"owner",
"->",
"getContentSummary",
"(",
"$",
"content",
")",
")",
";",
"}",
"return",
"DBField",
"::",
"create_field",
"(",
"'HTMLFragment'",
",",
"$",
"summary",
")",
"->",
"setProcessShortcodes",
"(",
"true",
")",
";",
"}"
] |
Answers the summary for the extended object.
@return DBHTMLText
|
[
"Answers",
"the",
"summary",
"for",
"the",
"extended",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L592-L605
|
231,760
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaSummaryLimited
|
public function getMetaSummaryLimited($maxSentences = 2)
{
if ($this->owner->hasMetaSummary()) {
return trim(preg_replace('/\s+/', ' ', $this->owner->getMetaSummary()->LimitSentences($maxSentences)));
}
}
|
php
|
public function getMetaSummaryLimited($maxSentences = 2)
{
if ($this->owner->hasMetaSummary()) {
return trim(preg_replace('/\s+/', ' ', $this->owner->getMetaSummary()->LimitSentences($maxSentences)));
}
}
|
[
"public",
"function",
"getMetaSummaryLimited",
"(",
"$",
"maxSentences",
"=",
"2",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"hasMetaSummary",
"(",
")",
")",
"{",
"return",
"trim",
"(",
"preg_replace",
"(",
"'/\\s+/'",
",",
"' '",
",",
"$",
"this",
"->",
"owner",
"->",
"getMetaSummary",
"(",
")",
"->",
"LimitSentences",
"(",
"$",
"maxSentences",
")",
")",
")",
";",
"}",
"}"
] |
Answers a plain-text version of the meta summary limited to the specified number of sentences.
@param integer $maxSentences
@return string
|
[
"Answers",
"a",
"plain",
"-",
"text",
"version",
"of",
"the",
"meta",
"summary",
"limited",
"to",
"the",
"specified",
"number",
"of",
"sentences",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L628-L633
|
231,761
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaContent
|
public function getMetaContent()
{
if ($this->owner->hasField('Content') && $this->owner->Content) {
return $this->owner->dbObject('Content');
}
}
|
php
|
public function getMetaContent()
{
if ($this->owner->hasField('Content') && $this->owner->Content) {
return $this->owner->dbObject('Content');
}
}
|
[
"public",
"function",
"getMetaContent",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"hasField",
"(",
"'Content'",
")",
"&&",
"$",
"this",
"->",
"owner",
"->",
"Content",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"dbObject",
"(",
"'Content'",
")",
";",
"}",
"}"
] |
Answers the content for the extended object.
@return DBHTMLText
|
[
"Answers",
"the",
"content",
"for",
"the",
"extended",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L640-L645
|
231,762
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaImageFolder
|
public function getMetaImageFolder()
{
if ($folder = $this->owner->config()->meta_image_folder) {
return $folder;
}
return Config::inst()->get(self::class, 'default_meta_image_folder');
}
|
php
|
public function getMetaImageFolder()
{
if ($folder = $this->owner->config()->meta_image_folder) {
return $folder;
}
return Config::inst()->get(self::class, 'default_meta_image_folder');
}
|
[
"public",
"function",
"getMetaImageFolder",
"(",
")",
"{",
"if",
"(",
"$",
"folder",
"=",
"$",
"this",
"->",
"owner",
"->",
"config",
"(",
")",
"->",
"meta_image_folder",
")",
"{",
"return",
"$",
"folder",
";",
"}",
"return",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"self",
"::",
"class",
",",
"'default_meta_image_folder'",
")",
";",
"}"
] |
Answers the name of the asset folder used for uploading images.
@return string
|
[
"Answers",
"the",
"name",
"of",
"the",
"asset",
"folder",
"used",
"for",
"uploading",
"images",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L702-L709
|
231,763
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaImageLink
|
public function getMetaImageLink()
{
if ($this->owner->hasMetaImage()) {
if ($renderer = $this->owner->Renderer) {
switch ($renderer->ImageLinksTo) {
case BaseListComponent::IMAGE_LINK_ITEM:
return $this->owner->getMetaLink();
}
}
return $this->owner->getMetaImageURL();
}
}
|
php
|
public function getMetaImageLink()
{
if ($this->owner->hasMetaImage()) {
if ($renderer = $this->owner->Renderer) {
switch ($renderer->ImageLinksTo) {
case BaseListComponent::IMAGE_LINK_ITEM:
return $this->owner->getMetaLink();
}
}
return $this->owner->getMetaImageURL();
}
}
|
[
"public",
"function",
"getMetaImageLink",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"hasMetaImage",
"(",
")",
")",
"{",
"if",
"(",
"$",
"renderer",
"=",
"$",
"this",
"->",
"owner",
"->",
"Renderer",
")",
"{",
"switch",
"(",
"$",
"renderer",
"->",
"ImageLinksTo",
")",
"{",
"case",
"BaseListComponent",
"::",
"IMAGE_LINK_ITEM",
":",
"return",
"$",
"this",
"->",
"owner",
"->",
"getMetaLink",
"(",
")",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"owner",
"->",
"getMetaImageURL",
"(",
")",
";",
"}",
"}"
] |
Answers the link for the meta image.
@return string
|
[
"Answers",
"the",
"link",
"for",
"the",
"meta",
"image",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L730-L748
|
231,764
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.isMetaImageFileLink
|
public function isMetaImageFileLink()
{
if ($this->owner->hasMetaImage()) {
return ($this->owner->getMetaImageLink() == $this->owner->getMetaImageURL());
}
return false;
}
|
php
|
public function isMetaImageFileLink()
{
if ($this->owner->hasMetaImage()) {
return ($this->owner->getMetaImageLink() == $this->owner->getMetaImageURL());
}
return false;
}
|
[
"public",
"function",
"isMetaImageFileLink",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"hasMetaImage",
"(",
")",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"owner",
"->",
"getMetaImageLink",
"(",
")",
"==",
"$",
"this",
"->",
"owner",
"->",
"getMetaImageURL",
"(",
")",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Answers true if the meta image link is to the image file.
@return boolean
|
[
"Answers",
"true",
"if",
"the",
"meta",
"image",
"link",
"is",
"to",
"the",
"image",
"file",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L767-L774
|
231,765
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaImageLinkAttributes
|
public function getMetaImageLinkAttributes()
{
$attributes = [
'href' => $this->owner->MetaImageLink,
'class' => $this->owner->MetaImageLinkClass,
'title' => $this->owner->MetaTitle
];
if ($extra = Config::inst()->get(self::class, 'image_link_attributes')) {
foreach ($extra as $name => $value) {
// Process Attribute Value:
$attributes[$name] = ViewTools::singleton()->processAttribute(
$value,
$this->owner,
$this->owner->Renderer
);
}
}
return $attributes;
}
|
php
|
public function getMetaImageLinkAttributes()
{
$attributes = [
'href' => $this->owner->MetaImageLink,
'class' => $this->owner->MetaImageLinkClass,
'title' => $this->owner->MetaTitle
];
if ($extra = Config::inst()->get(self::class, 'image_link_attributes')) {
foreach ($extra as $name => $value) {
// Process Attribute Value:
$attributes[$name] = ViewTools::singleton()->processAttribute(
$value,
$this->owner,
$this->owner->Renderer
);
}
}
return $attributes;
}
|
[
"public",
"function",
"getMetaImageLinkAttributes",
"(",
")",
"{",
"$",
"attributes",
"=",
"[",
"'href'",
"=>",
"$",
"this",
"->",
"owner",
"->",
"MetaImageLink",
",",
"'class'",
"=>",
"$",
"this",
"->",
"owner",
"->",
"MetaImageLinkClass",
",",
"'title'",
"=>",
"$",
"this",
"->",
"owner",
"->",
"MetaTitle",
"]",
";",
"if",
"(",
"$",
"extra",
"=",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"self",
"::",
"class",
",",
"'image_link_attributes'",
")",
")",
"{",
"foreach",
"(",
"$",
"extra",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"// Process Attribute Value:",
"$",
"attributes",
"[",
"$",
"name",
"]",
"=",
"ViewTools",
"::",
"singleton",
"(",
")",
"->",
"processAttribute",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"owner",
",",
"$",
"this",
"->",
"owner",
"->",
"Renderer",
")",
";",
"}",
"}",
"return",
"$",
"attributes",
";",
"}"
] |
Answers the HTML tag attributes for the image link as an array.
@return array
|
[
"Answers",
"the",
"HTML",
"tag",
"attributes",
"for",
"the",
"image",
"link",
"as",
"an",
"array",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L781-L806
|
231,766
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaImageResized
|
public function getMetaImageResized($width = null, $height = null, $method = null)
{
if ($this->owner->hasMetaImage()) {
return ImageTools::singleton()->resize(
$this->owner->getMetaImage(),
$this->owner->getMetaImageResizeWidth($width),
$this->owner->getMetaImageResizeHeight($height),
$this->owner->getMetaImageResizeMethod($method)
);
}
}
|
php
|
public function getMetaImageResized($width = null, $height = null, $method = null)
{
if ($this->owner->hasMetaImage()) {
return ImageTools::singleton()->resize(
$this->owner->getMetaImage(),
$this->owner->getMetaImageResizeWidth($width),
$this->owner->getMetaImageResizeHeight($height),
$this->owner->getMetaImageResizeMethod($method)
);
}
}
|
[
"public",
"function",
"getMetaImageResized",
"(",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
",",
"$",
"method",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"hasMetaImage",
"(",
")",
")",
"{",
"return",
"ImageTools",
"::",
"singleton",
"(",
")",
"->",
"resize",
"(",
"$",
"this",
"->",
"owner",
"->",
"getMetaImage",
"(",
")",
",",
"$",
"this",
"->",
"owner",
"->",
"getMetaImageResizeWidth",
"(",
"$",
"width",
")",
",",
"$",
"this",
"->",
"owner",
"->",
"getMetaImageResizeHeight",
"(",
"$",
"height",
")",
",",
"$",
"this",
"->",
"owner",
"->",
"getMetaImageResizeMethod",
"(",
"$",
"method",
")",
")",
";",
"}",
"}"
] |
Answers the meta image resized using the dimensions and resize method.
@param integer $width
@param integer $height
@param string $method
@return Image
|
[
"Answers",
"the",
"meta",
"image",
"resized",
"using",
"the",
"dimensions",
"and",
"resize",
"method",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L879-L891
|
231,767
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaImageResizeWidth
|
public function getMetaImageResizeWidth($width = null)
{
if ($width) {
return $width;
}
if ($width = $this->owner->ImageMetaResizeWidth) {
return $width;
}
return $this->owner->getFieldFromParent('DefaultImageResizeWidth');
}
|
php
|
public function getMetaImageResizeWidth($width = null)
{
if ($width) {
return $width;
}
if ($width = $this->owner->ImageMetaResizeWidth) {
return $width;
}
return $this->owner->getFieldFromParent('DefaultImageResizeWidth');
}
|
[
"public",
"function",
"getMetaImageResizeWidth",
"(",
"$",
"width",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"width",
")",
"{",
"return",
"$",
"width",
";",
"}",
"if",
"(",
"$",
"width",
"=",
"$",
"this",
"->",
"owner",
"->",
"ImageMetaResizeWidth",
")",
"{",
"return",
"$",
"width",
";",
"}",
"return",
"$",
"this",
"->",
"owner",
"->",
"getFieldFromParent",
"(",
"'DefaultImageResizeWidth'",
")",
";",
"}"
] |
Answers the resize width for the meta image.
@param integer $width
@return integer
|
[
"Answers",
"the",
"resize",
"width",
"for",
"the",
"meta",
"image",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L900-L911
|
231,768
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaImageResizeHeight
|
public function getMetaImageResizeHeight($height = null)
{
if ($height) {
return $height;
}
if ($height = $this->owner->ImageMetaResizeHeight) {
return $height;
}
return $this->owner->getFieldFromParent('DefaultImageResizeHeight');
}
|
php
|
public function getMetaImageResizeHeight($height = null)
{
if ($height) {
return $height;
}
if ($height = $this->owner->ImageMetaResizeHeight) {
return $height;
}
return $this->owner->getFieldFromParent('DefaultImageResizeHeight');
}
|
[
"public",
"function",
"getMetaImageResizeHeight",
"(",
"$",
"height",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"height",
")",
"{",
"return",
"$",
"height",
";",
"}",
"if",
"(",
"$",
"height",
"=",
"$",
"this",
"->",
"owner",
"->",
"ImageMetaResizeHeight",
")",
"{",
"return",
"$",
"height",
";",
"}",
"return",
"$",
"this",
"->",
"owner",
"->",
"getFieldFromParent",
"(",
"'DefaultImageResizeHeight'",
")",
";",
"}"
] |
Answers the resize height for the meta image.
@param integer $height
@return integer
|
[
"Answers",
"the",
"resize",
"height",
"for",
"the",
"meta",
"image",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L920-L931
|
231,769
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaImageResizeMethod
|
public function getMetaImageResizeMethod($method = null)
{
if ($method) {
return $method;
}
if ($method = $this->owner->ImageMetaResizeMethod) {
return $method;
}
return $this->owner->getFieldFromParent('DefaultImageResizeMethod');
}
|
php
|
public function getMetaImageResizeMethod($method = null)
{
if ($method) {
return $method;
}
if ($method = $this->owner->ImageMetaResizeMethod) {
return $method;
}
return $this->owner->getFieldFromParent('DefaultImageResizeMethod');
}
|
[
"public",
"function",
"getMetaImageResizeMethod",
"(",
"$",
"method",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"method",
")",
"{",
"return",
"$",
"method",
";",
"}",
"if",
"(",
"$",
"method",
"=",
"$",
"this",
"->",
"owner",
"->",
"ImageMetaResizeMethod",
")",
"{",
"return",
"$",
"method",
";",
"}",
"return",
"$",
"this",
"->",
"owner",
"->",
"getFieldFromParent",
"(",
"'DefaultImageResizeMethod'",
")",
";",
"}"
] |
Answers the resize method for the meta image.
@param string $method
@return string
|
[
"Answers",
"the",
"resize",
"method",
"for",
"the",
"meta",
"image",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L940-L951
|
231,770
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaImageAlignment
|
public function getMetaImageAlignment($alignment = null)
{
if ($alignment) {
return $alignment;
}
if ($alignment = $this->owner->ImageMetaAlignment) {
return $alignment;
}
return $this->owner->getFieldFromParent('DefaultImageAlignment');
}
|
php
|
public function getMetaImageAlignment($alignment = null)
{
if ($alignment) {
return $alignment;
}
if ($alignment = $this->owner->ImageMetaAlignment) {
return $alignment;
}
return $this->owner->getFieldFromParent('DefaultImageAlignment');
}
|
[
"public",
"function",
"getMetaImageAlignment",
"(",
"$",
"alignment",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"alignment",
")",
"{",
"return",
"$",
"alignment",
";",
"}",
"if",
"(",
"$",
"alignment",
"=",
"$",
"this",
"->",
"owner",
"->",
"ImageMetaAlignment",
")",
"{",
"return",
"$",
"alignment",
";",
"}",
"return",
"$",
"this",
"->",
"owner",
"->",
"getFieldFromParent",
"(",
"'DefaultImageAlignment'",
")",
";",
"}"
] |
Answers the alignment for the meta image.
@param string $alignment
@return string
|
[
"Answers",
"the",
"alignment",
"for",
"the",
"meta",
"image",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L960-L971
|
231,771
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaImageClassNames
|
public function getMetaImageClassNames()
{
$classes = $this->styles('image.fluid');
if ($alignment = $this->owner->getMetaImageAlignment()) {
$classes[] = $alignment;
}
return $classes;
}
|
php
|
public function getMetaImageClassNames()
{
$classes = $this->styles('image.fluid');
if ($alignment = $this->owner->getMetaImageAlignment()) {
$classes[] = $alignment;
}
return $classes;
}
|
[
"public",
"function",
"getMetaImageClassNames",
"(",
")",
"{",
"$",
"classes",
"=",
"$",
"this",
"->",
"styles",
"(",
"'image.fluid'",
")",
";",
"if",
"(",
"$",
"alignment",
"=",
"$",
"this",
"->",
"owner",
"->",
"getMetaImageAlignment",
"(",
")",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"$",
"alignment",
";",
"}",
"return",
"$",
"classes",
";",
"}"
] |
Answers an array of meta image class names for the template.
@return array
|
[
"Answers",
"an",
"array",
"of",
"meta",
"image",
"class",
"names",
"for",
"the",
"template",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L988-L997
|
231,772
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaImageLinked
|
public function getMetaImageLinked()
{
if (!is_null($this->owner->ImageMetaLinked)) {
return (boolean) $this->owner->ImageMetaLinked;
}
return $this->owner->getFieldFromParent('DefaultImageLinked');
}
|
php
|
public function getMetaImageLinked()
{
if (!is_null($this->owner->ImageMetaLinked)) {
return (boolean) $this->owner->ImageMetaLinked;
}
return $this->owner->getFieldFromParent('DefaultImageLinked');
}
|
[
"public",
"function",
"getMetaImageLinked",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"owner",
"->",
"ImageMetaLinked",
")",
")",
"{",
"return",
"(",
"boolean",
")",
"$",
"this",
"->",
"owner",
"->",
"ImageMetaLinked",
";",
"}",
"return",
"$",
"this",
"->",
"owner",
"->",
"getFieldFromParent",
"(",
"'DefaultImageLinked'",
")",
";",
"}"
] |
Answers true if the meta image is to be linked in the template.
@return boolean
|
[
"Answers",
"true",
"if",
"the",
"meta",
"image",
"is",
"to",
"be",
"linked",
"in",
"the",
"template",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L1004-L1011
|
231,773
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaImageLinkClassNames
|
public function getMetaImageLinkClassNames()
{
$classes = ['image-link'];
if ($renderer = $this->owner->Renderer) {
if ($to = strtolower($renderer->ImageLinksTo)) {
$classes[] = sprintf('to-%s', $to);
}
} elseif ($this->owner->isMetaImageFileLink()) {
$classes[] = 'to-file';
}
return $classes;
}
|
php
|
public function getMetaImageLinkClassNames()
{
$classes = ['image-link'];
if ($renderer = $this->owner->Renderer) {
if ($to = strtolower($renderer->ImageLinksTo)) {
$classes[] = sprintf('to-%s', $to);
}
} elseif ($this->owner->isMetaImageFileLink()) {
$classes[] = 'to-file';
}
return $classes;
}
|
[
"public",
"function",
"getMetaImageLinkClassNames",
"(",
")",
"{",
"$",
"classes",
"=",
"[",
"'image-link'",
"]",
";",
"if",
"(",
"$",
"renderer",
"=",
"$",
"this",
"->",
"owner",
"->",
"Renderer",
")",
"{",
"if",
"(",
"$",
"to",
"=",
"strtolower",
"(",
"$",
"renderer",
"->",
"ImageLinksTo",
")",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"sprintf",
"(",
"'to-%s'",
",",
"$",
"to",
")",
";",
"}",
"}",
"elseif",
"(",
"$",
"this",
"->",
"owner",
"->",
"isMetaImageFileLink",
"(",
")",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"'to-file'",
";",
"}",
"return",
"$",
"classes",
";",
"}"
] |
Answers an array of meta image link class names for the template.
@return array
|
[
"Answers",
"an",
"array",
"of",
"meta",
"image",
"link",
"class",
"names",
"for",
"the",
"template",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L1028-L1045
|
231,774
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaImageFooter
|
public function getMetaImageFooter()
{
if ($this->owner->hasMetaImageCaption()) {
return $this->owner->obj('MetaImageCaption')->Plain();
}
return $this->owner->getMetaSummaryLimited();
}
|
php
|
public function getMetaImageFooter()
{
if ($this->owner->hasMetaImageCaption()) {
return $this->owner->obj('MetaImageCaption')->Plain();
}
return $this->owner->getMetaSummaryLimited();
}
|
[
"public",
"function",
"getMetaImageFooter",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"hasMetaImageCaption",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"obj",
"(",
"'MetaImageCaption'",
")",
"->",
"Plain",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"owner",
"->",
"getMetaSummaryLimited",
"(",
")",
";",
"}"
] |
Answers the footer text for a meta image popup.
@return string
|
[
"Answers",
"the",
"footer",
"text",
"for",
"a",
"meta",
"image",
"popup",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L1078-L1085
|
231,775
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getMetaImageWrapperClassNames
|
public function getMetaImageWrapperClassNames()
{
$classes = [$this->owner->MetaImageCaptionShown ? 'captionImage' : 'image'];
if ($alignment = $this->owner->getMetaImageAlignment()) {
$classes[] = $alignment;
}
return $classes;
}
|
php
|
public function getMetaImageWrapperClassNames()
{
$classes = [$this->owner->MetaImageCaptionShown ? 'captionImage' : 'image'];
if ($alignment = $this->owner->getMetaImageAlignment()) {
$classes[] = $alignment;
}
return $classes;
}
|
[
"public",
"function",
"getMetaImageWrapperClassNames",
"(",
")",
"{",
"$",
"classes",
"=",
"[",
"$",
"this",
"->",
"owner",
"->",
"MetaImageCaptionShown",
"?",
"'captionImage'",
":",
"'image'",
"]",
";",
"if",
"(",
"$",
"alignment",
"=",
"$",
"this",
"->",
"owner",
"->",
"getMetaImageAlignment",
"(",
")",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"$",
"alignment",
";",
"}",
"return",
"$",
"classes",
";",
"}"
] |
Answers an array of meta image wrapper class names for the template.
@return array
|
[
"Answers",
"an",
"array",
"of",
"meta",
"image",
"wrapper",
"class",
"names",
"for",
"the",
"template",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L1102-L1111
|
231,776
|
praxisnetau/silverware
|
src/Extensions/Model/MetaDataExtension.php
|
MetaDataExtension.getContentSummary
|
public function getContentSummary(DBHTMLText $content)
{
switch ($this->owner->SummaryMode) {
case self::SUMMARY_FIRST_SENTENCE:
return $content->FirstSentence();
case self::SUMMARY_FIRST_PARAGRAPH:
return $content->FirstParagraph();
default:
return StringTools::singleton()->getContentSummary($content);
}
}
|
php
|
public function getContentSummary(DBHTMLText $content)
{
switch ($this->owner->SummaryMode) {
case self::SUMMARY_FIRST_SENTENCE:
return $content->FirstSentence();
case self::SUMMARY_FIRST_PARAGRAPH:
return $content->FirstParagraph();
default:
return StringTools::singleton()->getContentSummary($content);
}
}
|
[
"public",
"function",
"getContentSummary",
"(",
"DBHTMLText",
"$",
"content",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"owner",
"->",
"SummaryMode",
")",
"{",
"case",
"self",
"::",
"SUMMARY_FIRST_SENTENCE",
":",
"return",
"$",
"content",
"->",
"FirstSentence",
"(",
")",
";",
"case",
"self",
"::",
"SUMMARY_FIRST_PARAGRAPH",
":",
"return",
"$",
"content",
"->",
"FirstParagraph",
"(",
")",
";",
"default",
":",
"return",
"StringTools",
"::",
"singleton",
"(",
")",
"->",
"getContentSummary",
"(",
"$",
"content",
")",
";",
"}",
"}"
] |
Answers the appropriate summary of the given content field.
@param DBHTMLText $content
@return string
|
[
"Answers",
"the",
"appropriate",
"summary",
"of",
"the",
"given",
"content",
"field",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/MetaDataExtension.php#L1145-L1155
|
231,777
|
percymamedy/laravel-dev-booter
|
src/ServiceProvider.php
|
ServiceProvider.registerDevProviders
|
protected function registerDevProviders()
{
// Get Dev providers key.
$devProviderKey = 'dev-booter.dev_providers_config_keys.'.$this->app->environment();
// Register All dev providers.
$this->collectDevServiceProviders($devProviderKey)->each(function ($devServiceProviders) {
$this->app->register($devServiceProviders);
});
}
|
php
|
protected function registerDevProviders()
{
// Get Dev providers key.
$devProviderKey = 'dev-booter.dev_providers_config_keys.'.$this->app->environment();
// Register All dev providers.
$this->collectDevServiceProviders($devProviderKey)->each(function ($devServiceProviders) {
$this->app->register($devServiceProviders);
});
}
|
[
"protected",
"function",
"registerDevProviders",
"(",
")",
"{",
"// Get Dev providers key.",
"$",
"devProviderKey",
"=",
"'dev-booter.dev_providers_config_keys.'",
".",
"$",
"this",
"->",
"app",
"->",
"environment",
"(",
")",
";",
"// Register All dev providers.",
"$",
"this",
"->",
"collectDevServiceProviders",
"(",
"$",
"devProviderKey",
")",
"->",
"each",
"(",
"function",
"(",
"$",
"devServiceProviders",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"register",
"(",
"$",
"devServiceProviders",
")",
";",
"}",
")",
";",
"}"
] |
Register all dev providers.
@return void
|
[
"Register",
"all",
"dev",
"providers",
"."
] |
5231366c557f2e11b2167e1d58ef330285ea6cce
|
https://github.com/percymamedy/laravel-dev-booter/blob/5231366c557f2e11b2167e1d58ef330285ea6cce/src/ServiceProvider.php#L51-L60
|
231,778
|
percymamedy/laravel-dev-booter
|
src/ServiceProvider.php
|
ServiceProvider.bootDevAliases
|
protected function bootDevAliases()
{
//Get the instance of the alias loader
$loader = AliasLoader::getInstance();
// Get Dev class aliases config key.
$devProviderKey = 'dev-booter.dev_aliases_config_keys.'.$this->app->environment();
// Boot all classes Aliases.
$this->collectDevAliases($devProviderKey)->each(function ($facade, $alias) use ($loader) {
$loader->alias($alias, $facade);
});
}
|
php
|
protected function bootDevAliases()
{
//Get the instance of the alias loader
$loader = AliasLoader::getInstance();
// Get Dev class aliases config key.
$devProviderKey = 'dev-booter.dev_aliases_config_keys.'.$this->app->environment();
// Boot all classes Aliases.
$this->collectDevAliases($devProviderKey)->each(function ($facade, $alias) use ($loader) {
$loader->alias($alias, $facade);
});
}
|
[
"protected",
"function",
"bootDevAliases",
"(",
")",
"{",
"//Get the instance of the alias loader",
"$",
"loader",
"=",
"AliasLoader",
"::",
"getInstance",
"(",
")",
";",
"// Get Dev class aliases config key.",
"$",
"devProviderKey",
"=",
"'dev-booter.dev_aliases_config_keys.'",
".",
"$",
"this",
"->",
"app",
"->",
"environment",
"(",
")",
";",
"// Boot all classes Aliases.",
"$",
"this",
"->",
"collectDevAliases",
"(",
"$",
"devProviderKey",
")",
"->",
"each",
"(",
"function",
"(",
"$",
"facade",
",",
"$",
"alias",
")",
"use",
"(",
"$",
"loader",
")",
"{",
"$",
"loader",
"->",
"alias",
"(",
"$",
"alias",
",",
"$",
"facade",
")",
";",
"}",
")",
";",
"}"
] |
Boot all dev class aliases.
@return void
|
[
"Boot",
"all",
"dev",
"class",
"aliases",
"."
] |
5231366c557f2e11b2167e1d58ef330285ea6cce
|
https://github.com/percymamedy/laravel-dev-booter/blob/5231366c557f2e11b2167e1d58ef330285ea6cce/src/ServiceProvider.php#L67-L79
|
231,779
|
percymamedy/laravel-dev-booter
|
src/ServiceProvider.php
|
ServiceProvider.collectDevServiceProviders
|
protected function collectDevServiceProviders($configKey)
{
// Get the Config key where devProviders are located.
$devProvidersConfigLocation = Config::get($configKey);
// Get Providers keys.
$keys = is_string($devProvidersConfigLocation) ? [$devProvidersConfigLocation] : $devProvidersConfigLocation;
// Return Dev Providers.
return collect($keys)->transform(function ($location) {
// Transform each Location key to the actual array
// containing the Providers.
return Config::get($location);
})->reject(function ($arrayOfProviders) {
// Remove all null values
return is_null($arrayOfProviders);
})->flatten()->unique()->values();
}
|
php
|
protected function collectDevServiceProviders($configKey)
{
// Get the Config key where devProviders are located.
$devProvidersConfigLocation = Config::get($configKey);
// Get Providers keys.
$keys = is_string($devProvidersConfigLocation) ? [$devProvidersConfigLocation] : $devProvidersConfigLocation;
// Return Dev Providers.
return collect($keys)->transform(function ($location) {
// Transform each Location key to the actual array
// containing the Providers.
return Config::get($location);
})->reject(function ($arrayOfProviders) {
// Remove all null values
return is_null($arrayOfProviders);
})->flatten()->unique()->values();
}
|
[
"protected",
"function",
"collectDevServiceProviders",
"(",
"$",
"configKey",
")",
"{",
"// Get the Config key where devProviders are located.",
"$",
"devProvidersConfigLocation",
"=",
"Config",
"::",
"get",
"(",
"$",
"configKey",
")",
";",
"// Get Providers keys.",
"$",
"keys",
"=",
"is_string",
"(",
"$",
"devProvidersConfigLocation",
")",
"?",
"[",
"$",
"devProvidersConfigLocation",
"]",
":",
"$",
"devProvidersConfigLocation",
";",
"// Return Dev Providers.",
"return",
"collect",
"(",
"$",
"keys",
")",
"->",
"transform",
"(",
"function",
"(",
"$",
"location",
")",
"{",
"// Transform each Location key to the actual array",
"// containing the Providers.",
"return",
"Config",
"::",
"get",
"(",
"$",
"location",
")",
";",
"}",
")",
"->",
"reject",
"(",
"function",
"(",
"$",
"arrayOfProviders",
")",
"{",
"// Remove all null values",
"return",
"is_null",
"(",
"$",
"arrayOfProviders",
")",
";",
"}",
")",
"->",
"flatten",
"(",
")",
"->",
"unique",
"(",
")",
"->",
"values",
"(",
")",
";",
"}"
] |
Return Collection of Dev providers.
@param string $configKey
@return Collection
|
[
"Return",
"Collection",
"of",
"Dev",
"providers",
"."
] |
5231366c557f2e11b2167e1d58ef330285ea6cce
|
https://github.com/percymamedy/laravel-dev-booter/blob/5231366c557f2e11b2167e1d58ef330285ea6cce/src/ServiceProvider.php#L98-L115
|
231,780
|
percymamedy/laravel-dev-booter
|
src/ServiceProvider.php
|
ServiceProvider.collectDevAliases
|
protected function collectDevAliases($configKey)
{
// Get the Config key where dev aliases are located.
$devAliasesConfigLocation = Config::get($configKey);
// Get Aliases keys.
$keys = is_string($devAliasesConfigLocation) ? [$devAliasesConfigLocation] : $devAliasesConfigLocation;
return collect($keys)->transform(function ($location) {
// Transform each Location key to the actual array
// containing the Aliases.
return Config::get($location);
})->reject(function ($arrayOfProviders) {
// Remove all null values
return is_null($arrayOfProviders);
})->flatMap(function ($values) {
return $values;
})->unique();
}
|
php
|
protected function collectDevAliases($configKey)
{
// Get the Config key where dev aliases are located.
$devAliasesConfigLocation = Config::get($configKey);
// Get Aliases keys.
$keys = is_string($devAliasesConfigLocation) ? [$devAliasesConfigLocation] : $devAliasesConfigLocation;
return collect($keys)->transform(function ($location) {
// Transform each Location key to the actual array
// containing the Aliases.
return Config::get($location);
})->reject(function ($arrayOfProviders) {
// Remove all null values
return is_null($arrayOfProviders);
})->flatMap(function ($values) {
return $values;
})->unique();
}
|
[
"protected",
"function",
"collectDevAliases",
"(",
"$",
"configKey",
")",
"{",
"// Get the Config key where dev aliases are located.",
"$",
"devAliasesConfigLocation",
"=",
"Config",
"::",
"get",
"(",
"$",
"configKey",
")",
";",
"// Get Aliases keys.",
"$",
"keys",
"=",
"is_string",
"(",
"$",
"devAliasesConfigLocation",
")",
"?",
"[",
"$",
"devAliasesConfigLocation",
"]",
":",
"$",
"devAliasesConfigLocation",
";",
"return",
"collect",
"(",
"$",
"keys",
")",
"->",
"transform",
"(",
"function",
"(",
"$",
"location",
")",
"{",
"// Transform each Location key to the actual array",
"// containing the Aliases.",
"return",
"Config",
"::",
"get",
"(",
"$",
"location",
")",
";",
"}",
")",
"->",
"reject",
"(",
"function",
"(",
"$",
"arrayOfProviders",
")",
"{",
"// Remove all null values",
"return",
"is_null",
"(",
"$",
"arrayOfProviders",
")",
";",
"}",
")",
"->",
"flatMap",
"(",
"function",
"(",
"$",
"values",
")",
"{",
"return",
"$",
"values",
";",
"}",
")",
"->",
"unique",
"(",
")",
";",
"}"
] |
Return Collection of Dev aliases.
@param string $configKey
@return Collection
|
[
"Return",
"Collection",
"of",
"Dev",
"aliases",
"."
] |
5231366c557f2e11b2167e1d58ef330285ea6cce
|
https://github.com/percymamedy/laravel-dev-booter/blob/5231366c557f2e11b2167e1d58ef330285ea6cce/src/ServiceProvider.php#L124-L142
|
231,781
|
praxisnetau/silverware
|
src/Extensions/RenderableExtension.php
|
RenderableExtension.updateCMSTreeClasses
|
public function updateCMSTreeClasses(&$classes)
{
if ($this->owner->getField('Disabled')) {
$classes .= ' is-disabled';
} elseif ($this->owner->getField('Cached')) {
$classes .= ' is-cached';
}
}
|
php
|
public function updateCMSTreeClasses(&$classes)
{
if ($this->owner->getField('Disabled')) {
$classes .= ' is-disabled';
} elseif ($this->owner->getField('Cached')) {
$classes .= ' is-cached';
}
}
|
[
"public",
"function",
"updateCMSTreeClasses",
"(",
"&",
"$",
"classes",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"getField",
"(",
"'Disabled'",
")",
")",
"{",
"$",
"classes",
".=",
"' is-disabled'",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"owner",
"->",
"getField",
"(",
"'Cached'",
")",
")",
"{",
"$",
"classes",
".=",
"' is-cached'",
";",
"}",
"}"
] |
Updates the CMS tree classes of the extended object.
@param string $classes String of CMS tree classes from the extended object.
@return void
|
[
"Updates",
"the",
"CMS",
"tree",
"classes",
"of",
"the",
"extended",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/RenderableExtension.php#L212-L219
|
231,782
|
praxisnetau/silverware
|
src/Extensions/RenderableExtension.php
|
RenderableExtension.getCustomStylesConfig
|
public function getCustomStylesConfig()
{
$styles = [];
if (($config = $this->owner->config()->custom_styles) && is_array($config)) {
$styles = $config;
}
ksort($styles);
array_walk($styles, function (&$item) {
$item = $this->owner->cleanStyleClasses($item);
});
return $styles;
}
|
php
|
public function getCustomStylesConfig()
{
$styles = [];
if (($config = $this->owner->config()->custom_styles) && is_array($config)) {
$styles = $config;
}
ksort($styles);
array_walk($styles, function (&$item) {
$item = $this->owner->cleanStyleClasses($item);
});
return $styles;
}
|
[
"public",
"function",
"getCustomStylesConfig",
"(",
")",
"{",
"$",
"styles",
"=",
"[",
"]",
";",
"if",
"(",
"(",
"$",
"config",
"=",
"$",
"this",
"->",
"owner",
"->",
"config",
"(",
")",
"->",
"custom_styles",
")",
"&&",
"is_array",
"(",
"$",
"config",
")",
")",
"{",
"$",
"styles",
"=",
"$",
"config",
";",
"}",
"ksort",
"(",
"$",
"styles",
")",
";",
"array_walk",
"(",
"$",
"styles",
",",
"function",
"(",
"&",
"$",
"item",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"owner",
"->",
"cleanStyleClasses",
"(",
"$",
"item",
")",
";",
"}",
")",
";",
"return",
"$",
"styles",
";",
"}"
] |
Answers a sorted array of any custom styles configured for the extended object.
@return array
|
[
"Answers",
"a",
"sorted",
"array",
"of",
"any",
"custom",
"styles",
"configured",
"for",
"the",
"extended",
"object",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/RenderableExtension.php#L247-L262
|
231,783
|
praxisnetau/silverware
|
src/Extensions/RenderableExtension.php
|
RenderableExtension.getCustomStylesMappings
|
public function getCustomStylesMappings()
{
$config = $this->owner->getCustomStylesConfig();
if ($values = $this->owner->getField('CustomStyles')) {
$styles = Convert::json2array($values);
return array_intersect_key($config, array_flip($styles));
}
return [];
}
|
php
|
public function getCustomStylesMappings()
{
$config = $this->owner->getCustomStylesConfig();
if ($values = $this->owner->getField('CustomStyles')) {
$styles = Convert::json2array($values);
return array_intersect_key($config, array_flip($styles));
}
return [];
}
|
[
"public",
"function",
"getCustomStylesMappings",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"owner",
"->",
"getCustomStylesConfig",
"(",
")",
";",
"if",
"(",
"$",
"values",
"=",
"$",
"this",
"->",
"owner",
"->",
"getField",
"(",
"'CustomStyles'",
")",
")",
"{",
"$",
"styles",
"=",
"Convert",
"::",
"json2array",
"(",
"$",
"values",
")",
";",
"return",
"array_intersect_key",
"(",
"$",
"config",
",",
"array_flip",
"(",
"$",
"styles",
")",
")",
";",
"}",
"return",
"[",
"]",
";",
"}"
] |
Answers an array of selected custom styles mapped to their class names.
@return array
|
[
"Answers",
"an",
"array",
"of",
"selected",
"custom",
"styles",
"mapped",
"to",
"their",
"class",
"names",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/RenderableExtension.php#L279-L292
|
231,784
|
praxisnetau/silverware
|
src/Extensions/RenderableExtension.php
|
RenderableExtension.getCustomStylesOptions
|
public function getCustomStylesOptions()
{
$keys = array_keys($this->owner->getCustomStylesConfig());
return ArrayLib::valuekey($keys, $keys);
}
|
php
|
public function getCustomStylesOptions()
{
$keys = array_keys($this->owner->getCustomStylesConfig());
return ArrayLib::valuekey($keys, $keys);
}
|
[
"public",
"function",
"getCustomStylesOptions",
"(",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"owner",
"->",
"getCustomStylesConfig",
"(",
")",
")",
";",
"return",
"ArrayLib",
"::",
"valuekey",
"(",
"$",
"keys",
",",
"$",
"keys",
")",
";",
"}"
] |
Answers an array of options for the custom styles field.
@return array
|
[
"Answers",
"an",
"array",
"of",
"options",
"for",
"the",
"custom",
"styles",
"field",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/RenderableExtension.php#L299-L304
|
231,785
|
kamilZ/B2Backblaze
|
src/B2Backblaze/B2API.php
|
B2API.b2AuthorizeAccount
|
public function b2AuthorizeAccount()
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$response = $browser->get($this->url.'b2_authorize_account', array(
'Accept' => 'application/json',
'Content-type' => 'application/json',
'Authorization' => 'Basic '.$this->credentials,
));
return new B2Response($response);
}
|
php
|
public function b2AuthorizeAccount()
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$response = $browser->get($this->url.'b2_authorize_account', array(
'Accept' => 'application/json',
'Content-type' => 'application/json',
'Authorization' => 'Basic '.$this->credentials,
));
return new B2Response($response);
}
|
[
"public",
"function",
"b2AuthorizeAccount",
"(",
")",
"{",
"$",
"curl",
"=",
"$",
"this",
"->",
"prepareCurl",
"(",
")",
";",
"$",
"browser",
"=",
"new",
"Browser",
"(",
"$",
"curl",
")",
";",
"$",
"response",
"=",
"$",
"browser",
"->",
"get",
"(",
"$",
"this",
"->",
"url",
".",
"'b2_authorize_account'",
",",
"array",
"(",
"'Accept'",
"=>",
"'application/json'",
",",
"'Content-type'",
"=>",
"'application/json'",
",",
"'Authorization'",
"=>",
"'Basic '",
".",
"$",
"this",
"->",
"credentials",
",",
")",
")",
";",
"return",
"new",
"B2Response",
"(",
"$",
"response",
")",
";",
"}"
] |
b2_authorize_account
Used to log in to the B2 API. Returns an authorization token that can be used for account-level operations, and a URL that should be used as the base URL for subsequent API calls.
@return B2Response Example:
{
"accountId": "YOUR_ACCOUNT_ID",
"apiUrl": "https://api900.backblazeb2.com",
"authorizationToken": "2_20150807002553_443e98bf57f978fa58c284f8_24d25d99772e3ba927778b39c9b0198f412d2163_acct",
"downloadUrl": "https://f900.backblazeb2.com",
"minimumPartSize": 100000000
}
downloadUrl: The base URL to use for downloading files.
authorizationToken: An authorization token to use with all calls, other than b2_authorize_account, that need an Authorization header.
|
[
"b2_authorize_account",
"Used",
"to",
"log",
"in",
"to",
"the",
"B2",
"API",
".",
"Returns",
"an",
"authorization",
"token",
"that",
"can",
"be",
"used",
"for",
"account",
"-",
"level",
"operations",
"and",
"a",
"URL",
"that",
"should",
"be",
"used",
"as",
"the",
"base",
"URL",
"for",
"subsequent",
"API",
"calls",
"."
] |
64d25e60849f7bcb957a070af3231694da118f55
|
https://github.com/kamilZ/B2Backblaze/blob/64d25e60849f7bcb957a070af3231694da118f55/src/B2Backblaze/B2API.php#L48-L59
|
231,786
|
kamilZ/B2Backblaze
|
src/B2Backblaze/B2API.php
|
B2API.b2CancelLargeFile
|
public function b2CancelLargeFile($URL, $token, $fileId)
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'fileId' => $fileId,
);
$response = $browser->post($URL.'/b2api/v1/b2_cancel_large_file', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
php
|
public function b2CancelLargeFile($URL, $token, $fileId)
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'fileId' => $fileId,
);
$response = $browser->post($URL.'/b2api/v1/b2_cancel_large_file', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
[
"public",
"function",
"b2CancelLargeFile",
"(",
"$",
"URL",
",",
"$",
"token",
",",
"$",
"fileId",
")",
"{",
"$",
"curl",
"=",
"$",
"this",
"->",
"prepareCurl",
"(",
")",
";",
"$",
"browser",
"=",
"new",
"Browser",
"(",
"$",
"curl",
")",
";",
"$",
"payload",
"=",
"array",
"(",
"'fileId'",
"=>",
"$",
"fileId",
",",
")",
";",
"$",
"response",
"=",
"$",
"browser",
"->",
"post",
"(",
"$",
"URL",
".",
"'/b2api/v1/b2_cancel_large_file'",
",",
"$",
"this",
"->",
"getHeaders",
"(",
"$",
"token",
")",
",",
"json_encode",
"(",
"$",
"payload",
")",
")",
";",
"return",
"new",
"B2Response",
"(",
"$",
"response",
")",
";",
"}"
] |
b2_cancel_large_file
Cancels the upload of a large file, and deletes all of the parts that have been uploaded.
This will return an error if there is no active upload with the given file ID.
@param $URL
@param $token
@param $fileId
@return B2Response Example:
{
"accountId": "YOUR_ACCOUNT_ID",
"bucketId": "4a48fe8875c6214145260818",
"fileId": "4_za71f544e781e6891531b001a_f200ec353a2184825_d20160409_m004829_c000_v0001016_t0028",
"fileName": "bigfile.dat"
}
@throws B2Exception When token is null
|
[
"b2_cancel_large_file",
"Cancels",
"the",
"upload",
"of",
"a",
"large",
"file",
"and",
"deletes",
"all",
"of",
"the",
"parts",
"that",
"have",
"been",
"uploaded",
".",
"This",
"will",
"return",
"an",
"error",
"if",
"there",
"is",
"no",
"active",
"upload",
"with",
"the",
"given",
"file",
"ID",
"."
] |
64d25e60849f7bcb957a070af3231694da118f55
|
https://github.com/kamilZ/B2Backblaze/blob/64d25e60849f7bcb957a070af3231694da118f55/src/B2Backblaze/B2API.php#L82-L92
|
231,787
|
kamilZ/B2Backblaze
|
src/B2Backblaze/B2API.php
|
B2API.b2GetUploadURL
|
public function b2GetUploadURL($URL, $token, $backedId)
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'bucketId' => $backedId,
);
$response = $browser->post($URL.'/b2api/v1/b2_get_upload_url', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
php
|
public function b2GetUploadURL($URL, $token, $backedId)
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'bucketId' => $backedId,
);
$response = $browser->post($URL.'/b2api/v1/b2_get_upload_url', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
[
"public",
"function",
"b2GetUploadURL",
"(",
"$",
"URL",
",",
"$",
"token",
",",
"$",
"backedId",
")",
"{",
"$",
"curl",
"=",
"$",
"this",
"->",
"prepareCurl",
"(",
")",
";",
"$",
"browser",
"=",
"new",
"Browser",
"(",
"$",
"curl",
")",
";",
"$",
"payload",
"=",
"array",
"(",
"'bucketId'",
"=>",
"$",
"backedId",
",",
")",
";",
"$",
"response",
"=",
"$",
"browser",
"->",
"post",
"(",
"$",
"URL",
".",
"'/b2api/v1/b2_get_upload_url'",
",",
"$",
"this",
"->",
"getHeaders",
"(",
"$",
"token",
")",
",",
"json_encode",
"(",
"$",
"payload",
")",
")",
";",
"return",
"new",
"B2Response",
"(",
"$",
"response",
")",
";",
"}"
] |
Gets an URL to use for uploading files.
When you upload a file to B2, you must call b2_get_upload_url first to get the URL for uploading.
Then, you use b2_upload_file on this URL to upload your file.
@param $URL
@param $token
@param $backedId
@return B2Response Example:
{
"bucketId" : "4a48fe8875c6214145260818",
"uploadUrl" : "https://pod-000-1005-03.backblaze.com/b2api/v1/b2_upload_file?cvt=c001_v0001005_t0027&bucket=4a48fe8875c6214145260818",
"authorizationToken" : "2_20151009170037_f504a0f39a0f4e657337e624_9754dde94359bd7b8f1445c8f4cc1a231a33f714_upld"
}
@throws B2Exception When token is null
|
[
"Gets",
"an",
"URL",
"to",
"use",
"for",
"uploading",
"files",
".",
"When",
"you",
"upload",
"a",
"file",
"to",
"B2",
"you",
"must",
"call",
"b2_get_upload_url",
"first",
"to",
"get",
"the",
"URL",
"for",
"uploading",
".",
"Then",
"you",
"use",
"b2_upload_file",
"on",
"this",
"URL",
"to",
"upload",
"your",
"file",
"."
] |
64d25e60849f7bcb957a070af3231694da118f55
|
https://github.com/kamilZ/B2Backblaze/blob/64d25e60849f7bcb957a070af3231694da118f55/src/B2Backblaze/B2API.php#L113-L123
|
231,788
|
kamilZ/B2Backblaze
|
src/B2Backblaze/B2API.php
|
B2API.b2CreateBucket
|
public function b2CreateBucket($URL, $token, $name, $public = false, $lifecycleRules = null)
{
if (count_chars($name) < 5 && count_chars($name) > 50) {
throw new B2Exception('Invalid bucket name');
}
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'accountId' => $this->accountId,
'bucketName' => $name,
'bucketType' => $public ? 'allPublic' : 'allPrivate',
);
if($lifecycleRules != null){
$payload['lifecycleRules'] = $lifecycleRules;
}
$response = $browser->post($URL.'/b2api/v1/b2_create_bucket', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
php
|
public function b2CreateBucket($URL, $token, $name, $public = false, $lifecycleRules = null)
{
if (count_chars($name) < 5 && count_chars($name) > 50) {
throw new B2Exception('Invalid bucket name');
}
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'accountId' => $this->accountId,
'bucketName' => $name,
'bucketType' => $public ? 'allPublic' : 'allPrivate',
);
if($lifecycleRules != null){
$payload['lifecycleRules'] = $lifecycleRules;
}
$response = $browser->post($URL.'/b2api/v1/b2_create_bucket', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
[
"public",
"function",
"b2CreateBucket",
"(",
"$",
"URL",
",",
"$",
"token",
",",
"$",
"name",
",",
"$",
"public",
"=",
"false",
",",
"$",
"lifecycleRules",
"=",
"null",
")",
"{",
"if",
"(",
"count_chars",
"(",
"$",
"name",
")",
"<",
"5",
"&&",
"count_chars",
"(",
"$",
"name",
")",
">",
"50",
")",
"{",
"throw",
"new",
"B2Exception",
"(",
"'Invalid bucket name'",
")",
";",
"}",
"$",
"curl",
"=",
"$",
"this",
"->",
"prepareCurl",
"(",
")",
";",
"$",
"browser",
"=",
"new",
"Browser",
"(",
"$",
"curl",
")",
";",
"$",
"payload",
"=",
"array",
"(",
"'accountId'",
"=>",
"$",
"this",
"->",
"accountId",
",",
"'bucketName'",
"=>",
"$",
"name",
",",
"'bucketType'",
"=>",
"$",
"public",
"?",
"'allPublic'",
":",
"'allPrivate'",
",",
")",
";",
"if",
"(",
"$",
"lifecycleRules",
"!=",
"null",
")",
"{",
"$",
"payload",
"[",
"'lifecycleRules'",
"]",
"=",
"$",
"lifecycleRules",
";",
"}",
"$",
"response",
"=",
"$",
"browser",
"->",
"post",
"(",
"$",
"URL",
".",
"'/b2api/v1/b2_create_bucket'",
",",
"$",
"this",
"->",
"getHeaders",
"(",
"$",
"token",
")",
",",
"json_encode",
"(",
"$",
"payload",
")",
")",
";",
"return",
"new",
"B2Response",
"(",
"$",
"response",
")",
";",
"}"
] |
Creates a new bucket. A bucket belongs to the account used to create it.
Buckets can be named. The name must be globally unique. No account can use a bucket with the same name.
Buckets are assigned a unique bucketId which is used when uploading, downloading, or deleting files.
@param String $URL Obtained from b2AuthorizeAccount call
@param String $token Obtained from b2AuthorizeAccount call
@param String $name 6 char min, 50 char max: letters, digits, - and _
@param bool $public
@param String[] $lifecycleRules The initial list (a JSON array) of lifecycle rules for this bucket.
@return B2Response Example:
{
"accountId" : "010203040506",
"bucketId" : "4a48fe8875c6214145260818",
"bucketInfo" : {},
"bucketName" : "any-name-you-pick",
"bucketType" : "allPrivate",
"lifecycleRules" : []
}
@throws B2Exception
|
[
"Creates",
"a",
"new",
"bucket",
".",
"A",
"bucket",
"belongs",
"to",
"the",
"account",
"used",
"to",
"create",
"it",
".",
"Buckets",
"can",
"be",
"named",
".",
"The",
"name",
"must",
"be",
"globally",
"unique",
".",
"No",
"account",
"can",
"use",
"a",
"bucket",
"with",
"the",
"same",
"name",
".",
"Buckets",
"are",
"assigned",
"a",
"unique",
"bucketId",
"which",
"is",
"used",
"when",
"uploading",
"downloading",
"or",
"deleting",
"files",
"."
] |
64d25e60849f7bcb957a070af3231694da118f55
|
https://github.com/kamilZ/B2Backblaze/blob/64d25e60849f7bcb957a070af3231694da118f55/src/B2Backblaze/B2API.php#L148-L166
|
231,789
|
kamilZ/B2Backblaze
|
src/B2Backblaze/B2API.php
|
B2API.b2DeleteBucket
|
public function b2DeleteBucket($URL, $token, $bucketId)
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'accountId' => $this->accountId,
'bucketId' => $bucketId,
);
$response = $browser->post($URL.'/b2api/v1/b2_delete_bucket', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
php
|
public function b2DeleteBucket($URL, $token, $bucketId)
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'accountId' => $this->accountId,
'bucketId' => $bucketId,
);
$response = $browser->post($URL.'/b2api/v1/b2_delete_bucket', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
[
"public",
"function",
"b2DeleteBucket",
"(",
"$",
"URL",
",",
"$",
"token",
",",
"$",
"bucketId",
")",
"{",
"$",
"curl",
"=",
"$",
"this",
"->",
"prepareCurl",
"(",
")",
";",
"$",
"browser",
"=",
"new",
"Browser",
"(",
"$",
"curl",
")",
";",
"$",
"payload",
"=",
"array",
"(",
"'accountId'",
"=>",
"$",
"this",
"->",
"accountId",
",",
"'bucketId'",
"=>",
"$",
"bucketId",
",",
")",
";",
"$",
"response",
"=",
"$",
"browser",
"->",
"post",
"(",
"$",
"URL",
".",
"'/b2api/v1/b2_delete_bucket'",
",",
"$",
"this",
"->",
"getHeaders",
"(",
"$",
"token",
")",
",",
"json_encode",
"(",
"$",
"payload",
")",
")",
";",
"return",
"new",
"B2Response",
"(",
"$",
"response",
")",
";",
"}"
] |
Deletes the bucket specified. Only buckets that contain no version of any files can be deleted.
@param String $URL Obtained from b2AuthorizeAccount call
@param String $token Obtained from b2AuthorizeAccount call
@param String $bucketId The ID of the bucket you want to delete
@return B2Response Example:
{
"bucketId" : "4a48fe8875c6214145260818",
"accountId" : "010203040506",
"bucketName" : "any_name_you_pick",
"bucketType" : "allPrivate"
}
@throws B2Exception
|
[
"Deletes",
"the",
"bucket",
"specified",
".",
"Only",
"buckets",
"that",
"contain",
"no",
"version",
"of",
"any",
"files",
"can",
"be",
"deleted",
"."
] |
64d25e60849f7bcb957a070af3231694da118f55
|
https://github.com/kamilZ/B2Backblaze/blob/64d25e60849f7bcb957a070af3231694da118f55/src/B2Backblaze/B2API.php#L185-L196
|
231,790
|
kamilZ/B2Backblaze
|
src/B2Backblaze/B2API.php
|
B2API.b2DownloadFileById
|
public function b2DownloadFileById($downloadURL, $fileId, $download = false, $metadataOnly = false)
{
$uri = $downloadURL.'/b2api/v1/b2_download_file_by_id?fileId='.urlencode($fileId);
if (!$download) {
return $uri;
}
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$response = $metadataOnly ? $browser->head($uri) : $browser->get($uri);
return new B2Response($response, false);
}
|
php
|
public function b2DownloadFileById($downloadURL, $fileId, $download = false, $metadataOnly = false)
{
$uri = $downloadURL.'/b2api/v1/b2_download_file_by_id?fileId='.urlencode($fileId);
if (!$download) {
return $uri;
}
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$response = $metadataOnly ? $browser->head($uri) : $browser->get($uri);
return new B2Response($response, false);
}
|
[
"public",
"function",
"b2DownloadFileById",
"(",
"$",
"downloadURL",
",",
"$",
"fileId",
",",
"$",
"download",
"=",
"false",
",",
"$",
"metadataOnly",
"=",
"false",
")",
"{",
"$",
"uri",
"=",
"$",
"downloadURL",
".",
"'/b2api/v1/b2_download_file_by_id?fileId='",
".",
"urlencode",
"(",
"$",
"fileId",
")",
";",
"if",
"(",
"!",
"$",
"download",
")",
"{",
"return",
"$",
"uri",
";",
"}",
"$",
"curl",
"=",
"$",
"this",
"->",
"prepareCurl",
"(",
")",
";",
"$",
"browser",
"=",
"new",
"Browser",
"(",
"$",
"curl",
")",
";",
"$",
"response",
"=",
"$",
"metadataOnly",
"?",
"$",
"browser",
"->",
"head",
"(",
"$",
"uri",
")",
":",
"$",
"browser",
"->",
"get",
"(",
"$",
"uri",
")",
";",
"return",
"new",
"B2Response",
"(",
"$",
"response",
",",
"false",
")",
";",
"}"
] |
Downloads one file from B2.
If the version you delete is the latest version, and there are older versions,
then the most recent older version will become the current version,
and be the one that you'll get when downloading by name.
@param String $downloadURL Obtained from b2GetUploadURL call
@param String $fileId The ID of the file you want to delete
@param bool $download Return URL or download directly
@param bool $metadataOnly TRUE for headers array, FALSE for content too
@return B2Response
@throws B2Exception
|
[
"Downloads",
"one",
"file",
"from",
"B2",
".",
"If",
"the",
"version",
"you",
"delete",
"is",
"the",
"latest",
"version",
"and",
"there",
"are",
"older",
"versions",
"then",
"the",
"most",
"recent",
"older",
"version",
"will",
"become",
"the",
"current",
"version",
"and",
"be",
"the",
"one",
"that",
"you",
"ll",
"get",
"when",
"downloading",
"by",
"name",
"."
] |
64d25e60849f7bcb957a070af3231694da118f55
|
https://github.com/kamilZ/B2Backblaze/blob/64d25e60849f7bcb957a070af3231694da118f55/src/B2Backblaze/B2API.php#L245-L256
|
231,791
|
kamilZ/B2Backblaze
|
src/B2Backblaze/B2API.php
|
B2API.b2DownloadFileByName
|
public function b2DownloadFileByName($downloadURL, $bucketName, $fileName, $token = null, $metadataOnly = false)
{
$uri = $downloadURL.'/file/'.$bucketName.'/'.$fileName;
$curl = $this->prepareCurl();
if (is_null($token)) {
$curl->setVerifyPeer(false); // ensure it.
}
$browser = new Browser($curl);
if (is_null($token)) {
$headers = [];
} else {
$headers = $this->getHeaders($token);
}
$response = $metadataOnly ? $browser->head($uri, $headers) : $browser->get($uri, $headers);
return new B2Response($response, false);
}
|
php
|
public function b2DownloadFileByName($downloadURL, $bucketName, $fileName, $token = null, $metadataOnly = false)
{
$uri = $downloadURL.'/file/'.$bucketName.'/'.$fileName;
$curl = $this->prepareCurl();
if (is_null($token)) {
$curl->setVerifyPeer(false); // ensure it.
}
$browser = new Browser($curl);
if (is_null($token)) {
$headers = [];
} else {
$headers = $this->getHeaders($token);
}
$response = $metadataOnly ? $browser->head($uri, $headers) : $browser->get($uri, $headers);
return new B2Response($response, false);
}
|
[
"public",
"function",
"b2DownloadFileByName",
"(",
"$",
"downloadURL",
",",
"$",
"bucketName",
",",
"$",
"fileName",
",",
"$",
"token",
"=",
"null",
",",
"$",
"metadataOnly",
"=",
"false",
")",
"{",
"$",
"uri",
"=",
"$",
"downloadURL",
".",
"'/file/'",
".",
"$",
"bucketName",
".",
"'/'",
".",
"$",
"fileName",
";",
"$",
"curl",
"=",
"$",
"this",
"->",
"prepareCurl",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"token",
")",
")",
"{",
"$",
"curl",
"->",
"setVerifyPeer",
"(",
"false",
")",
";",
"// ensure it.",
"}",
"$",
"browser",
"=",
"new",
"Browser",
"(",
"$",
"curl",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"token",
")",
")",
"{",
"$",
"headers",
"=",
"[",
"]",
";",
"}",
"else",
"{",
"$",
"headers",
"=",
"$",
"this",
"->",
"getHeaders",
"(",
"$",
"token",
")",
";",
"}",
"$",
"response",
"=",
"$",
"metadataOnly",
"?",
"$",
"browser",
"->",
"head",
"(",
"$",
"uri",
",",
"$",
"headers",
")",
":",
"$",
"browser",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"headers",
")",
";",
"return",
"new",
"B2Response",
"(",
"$",
"response",
",",
"false",
")",
";",
"}"
] |
Downloads one file by providing the name of the bucket and the name of the file.
@param String $downloadURL Obtained from b2AuthorizeAccount call
@param string $bucketName The bucket name of file
@param string $fileName The name of the file, in percent-encoded UTF-8
@param string $token Can be null if your bucket is public otherwise An upload authorization token from authorization request
@param bool $metadataOnly True for headers array, False for content too
@return B2Response
@throws B2Exception
|
[
"Downloads",
"one",
"file",
"by",
"providing",
"the",
"name",
"of",
"the",
"bucket",
"and",
"the",
"name",
"of",
"the",
"file",
"."
] |
64d25e60849f7bcb957a070af3231694da118f55
|
https://github.com/kamilZ/B2Backblaze/blob/64d25e60849f7bcb957a070af3231694da118f55/src/B2Backblaze/B2API.php#L272-L288
|
231,792
|
kamilZ/B2Backblaze
|
src/B2Backblaze/B2API.php
|
B2API.b2GetDownloadAuthorization
|
public function b2GetDownloadAuthorization($URL, $token, $bucketId, $fileNamePrefix, $validDurationInSeconds = 86400)
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'bucketId' => $bucketId,
'fileNamePrefix' => $fileNamePrefix,
'validDurationInSeconds' => $validDurationInSeconds,
);
$response = $browser->post($URL.'/b2api/v1/b2_get_download_authorization', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
php
|
public function b2GetDownloadAuthorization($URL, $token, $bucketId, $fileNamePrefix, $validDurationInSeconds = 86400)
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'bucketId' => $bucketId,
'fileNamePrefix' => $fileNamePrefix,
'validDurationInSeconds' => $validDurationInSeconds,
);
$response = $browser->post($URL.'/b2api/v1/b2_get_download_authorization', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
[
"public",
"function",
"b2GetDownloadAuthorization",
"(",
"$",
"URL",
",",
"$",
"token",
",",
"$",
"bucketId",
",",
"$",
"fileNamePrefix",
",",
"$",
"validDurationInSeconds",
"=",
"86400",
")",
"{",
"$",
"curl",
"=",
"$",
"this",
"->",
"prepareCurl",
"(",
")",
";",
"$",
"browser",
"=",
"new",
"Browser",
"(",
"$",
"curl",
")",
";",
"$",
"payload",
"=",
"array",
"(",
"'bucketId'",
"=>",
"$",
"bucketId",
",",
"'fileNamePrefix'",
"=>",
"$",
"fileNamePrefix",
",",
"'validDurationInSeconds'",
"=>",
"$",
"validDurationInSeconds",
",",
")",
";",
"$",
"response",
"=",
"$",
"browser",
"->",
"post",
"(",
"$",
"URL",
".",
"'/b2api/v1/b2_get_download_authorization'",
",",
"$",
"this",
"->",
"getHeaders",
"(",
"$",
"token",
")",
",",
"json_encode",
"(",
"$",
"payload",
")",
")",
";",
"return",
"new",
"B2Response",
"(",
"$",
"response",
")",
";",
"}"
] |
b2_get_download_authorization
Used to generate an authorization token that can be used to download files with the specified prefix from a
private B2 bucket. Returns an authorization token that can be passed to b2_download_file_by_name
in the Authorization header or as an Authorization parameter.
@param String $URL Obtained from b2AuthorizeAccount call
@param String $token Obtained from b2AuthorizeAccount call
@param String $bucketId The ID of the bucket you want to get the authorization
@param String $fileNamePrefix The file name prefix of files the download authorization will allow
@param int $validDurationInSeconds The number of seconds the authorization is valid for
@return B2Response Example:
{
"authorizationToken": "3_20160803004041_53982a92f631a8c7303e3266_d940c7f5ee17cd1de3758aaacf1024188bc0cd0b_000_20160804004041_0006_dnld",
"bucketId": "a71f544e781e6891531b001a",
"fileNamePrefix": "public"
}
@throws B2Exception
|
[
"b2_get_download_authorization",
"Used",
"to",
"generate",
"an",
"authorization",
"token",
"that",
"can",
"be",
"used",
"to",
"download",
"files",
"with",
"the",
"specified",
"prefix",
"from",
"a",
"private",
"B2",
"bucket",
".",
"Returns",
"an",
"authorization",
"token",
"that",
"can",
"be",
"passed",
"to",
"b2_download_file_by_name",
"in",
"the",
"Authorization",
"header",
"or",
"as",
"an",
"Authorization",
"parameter",
"."
] |
64d25e60849f7bcb957a070af3231694da118f55
|
https://github.com/kamilZ/B2Backblaze/blob/64d25e60849f7bcb957a070af3231694da118f55/src/B2Backblaze/B2API.php#L312-L324
|
231,793
|
kamilZ/B2Backblaze
|
src/B2Backblaze/B2API.php
|
B2API.b2HideFile
|
public function b2HideFile($URL, $token, $bucketId, $fileName)
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'bucketId' => $bucketId,
'fileName' => $fileName,
);
$response = $browser->post($URL.'/b2api/v1/b2_hide_file', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
php
|
public function b2HideFile($URL, $token, $bucketId, $fileName)
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'bucketId' => $bucketId,
'fileName' => $fileName,
);
$response = $browser->post($URL.'/b2api/v1/b2_hide_file', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
[
"public",
"function",
"b2HideFile",
"(",
"$",
"URL",
",",
"$",
"token",
",",
"$",
"bucketId",
",",
"$",
"fileName",
")",
"{",
"$",
"curl",
"=",
"$",
"this",
"->",
"prepareCurl",
"(",
")",
";",
"$",
"browser",
"=",
"new",
"Browser",
"(",
"$",
"curl",
")",
";",
"$",
"payload",
"=",
"array",
"(",
"'bucketId'",
"=>",
"$",
"bucketId",
",",
"'fileName'",
"=>",
"$",
"fileName",
",",
")",
";",
"$",
"response",
"=",
"$",
"browser",
"->",
"post",
"(",
"$",
"URL",
".",
"'/b2api/v1/b2_hide_file'",
",",
"$",
"this",
"->",
"getHeaders",
"(",
"$",
"token",
")",
",",
"json_encode",
"(",
"$",
"payload",
")",
")",
";",
"return",
"new",
"B2Response",
"(",
"$",
"response",
")",
";",
"}"
] |
Hides a file so that downloading by name will not find the file,
but previous versions of the file are still stored.
See File Versions about what it means to hide a file.
@param String $URL Obtained from b2_authorize_account call
@param string $token Obtained from b2_authorize_account call
@param string $bucketId The ID of the bucket
@param string $fileName The name of the file, in percent-encoded UTF-8
@return B2Response
{
"action" : "hide",
"fileId" : "4_h4a48fe8875c6214145260818_f000000000000472a_d20140104_m032022_c001_v0000123_t0104",
"fileName" : "typing_test.txt",
"uploadTimestamp" : 1437815673000
}
@throws B2Exception
|
[
"Hides",
"a",
"file",
"so",
"that",
"downloading",
"by",
"name",
"will",
"not",
"find",
"the",
"file",
"but",
"previous",
"versions",
"of",
"the",
"file",
"are",
"still",
"stored",
".",
"See",
"File",
"Versions",
"about",
"what",
"it",
"means",
"to",
"hide",
"a",
"file",
"."
] |
64d25e60849f7bcb957a070af3231694da118f55
|
https://github.com/kamilZ/B2Backblaze/blob/64d25e60849f7bcb957a070af3231694da118f55/src/B2Backblaze/B2API.php#L454-L465
|
231,794
|
kamilZ/B2Backblaze
|
src/B2Backblaze/B2API.php
|
B2API.b2ListFileNames
|
public function b2ListFileNames($URL, $token, $bucketId, $startFileName = null, $maxFileCount = 100, $prefix = null, $delimiter = null)
{
if ($maxFileCount > 1000) {
throw new B2Exception('The maximum allowed is 1000');
}
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'bucketId' => $bucketId,
'maxFileCount' => $maxFileCount,
);
if (!is_null($startFileName)) {
$payload['startFileName'] = $startFileName;
}
if(!is_null($prefix)){
$payload["prefix"] = $prefix;
}
if(!is_null($delimiter)){
$payload["delimiter"] = $delimiter;
}
$response = $browser->post($URL.'/b2api/v1/b2_list_file_names', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
php
|
public function b2ListFileNames($URL, $token, $bucketId, $startFileName = null, $maxFileCount = 100, $prefix = null, $delimiter = null)
{
if ($maxFileCount > 1000) {
throw new B2Exception('The maximum allowed is 1000');
}
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'bucketId' => $bucketId,
'maxFileCount' => $maxFileCount,
);
if (!is_null($startFileName)) {
$payload['startFileName'] = $startFileName;
}
if(!is_null($prefix)){
$payload["prefix"] = $prefix;
}
if(!is_null($delimiter)){
$payload["delimiter"] = $delimiter;
}
$response = $browser->post($URL.'/b2api/v1/b2_list_file_names', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
[
"public",
"function",
"b2ListFileNames",
"(",
"$",
"URL",
",",
"$",
"token",
",",
"$",
"bucketId",
",",
"$",
"startFileName",
"=",
"null",
",",
"$",
"maxFileCount",
"=",
"100",
",",
"$",
"prefix",
"=",
"null",
",",
"$",
"delimiter",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"maxFileCount",
">",
"1000",
")",
"{",
"throw",
"new",
"B2Exception",
"(",
"'The maximum allowed is 1000'",
")",
";",
"}",
"$",
"curl",
"=",
"$",
"this",
"->",
"prepareCurl",
"(",
")",
";",
"$",
"browser",
"=",
"new",
"Browser",
"(",
"$",
"curl",
")",
";",
"$",
"payload",
"=",
"array",
"(",
"'bucketId'",
"=>",
"$",
"bucketId",
",",
"'maxFileCount'",
"=>",
"$",
"maxFileCount",
",",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"startFileName",
")",
")",
"{",
"$",
"payload",
"[",
"'startFileName'",
"]",
"=",
"$",
"startFileName",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"prefix",
")",
")",
"{",
"$",
"payload",
"[",
"\"prefix\"",
"]",
"=",
"$",
"prefix",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"delimiter",
")",
")",
"{",
"$",
"payload",
"[",
"\"delimiter\"",
"]",
"=",
"$",
"delimiter",
";",
"}",
"$",
"response",
"=",
"$",
"browser",
"->",
"post",
"(",
"$",
"URL",
".",
"'/b2api/v1/b2_list_file_names'",
",",
"$",
"this",
"->",
"getHeaders",
"(",
"$",
"token",
")",
",",
"json_encode",
"(",
"$",
"payload",
")",
")",
";",
"return",
"new",
"B2Response",
"(",
"$",
"response",
")",
";",
"}"
] |
Lists the names of all files in a bucket, starting at a given name.
This call returns at most 1000 file names, but it can be called repeatedly
to scan through all of the file names in a bucket. Each time you call,
it returns an "endFileName" that can be used as the starting point for the next call.
@param String $URL Obtained from b2_authorize_account call
@param string $token Obtained from b2_authorize_account call
@param string $bucketId The ID of the bucket
@param null|String $startFileName The first file name to return.
@param int $maxFileCount The maximum number of files to return from this call. The default value is 100, and the maximum allowed is 1000.
@param string $prefix Files returned will be limited to those with the given prefix. Defaults to the empty string, which matches all files.
@param string $delimiter Files returned will be limited to those within the top folder, or any one subfolder. Defaults to NULL. Folder names will also be returned. The delimiter character will be used to "break" file names into folders.
@return B2Response {
"files": [
{
"action": "upload",
"contentLength": 6,
"fileId": "4_z27c88f1d182b150646ff0b16_f1004ba650fe24e6b_d20150809_m012853_c100_v0009990_t0000",
"fileName": "files/hello.txt",
"size": 6,
"uploadTimestamp": 1439083733000
},
{
"action": "upload",
"fileId": "4_z27c88f1d182b150646ff0b16_f1004ba650fe24e6c_d20150809_m012854_c100_v0009990_t0000",
"fileName": "files/world.txt",
"contentLength": 6,
"size": 6,
"uploadTimestamp": 1439083734000
}
],
"nextFileName": null
}
nextFileName: What to pass in to startFileName for the next search.
@throws B2Exception
|
[
"Lists",
"the",
"names",
"of",
"all",
"files",
"in",
"a",
"bucket",
"starting",
"at",
"a",
"given",
"name",
".",
"This",
"call",
"returns",
"at",
"most",
"1000",
"file",
"names",
"but",
"it",
"can",
"be",
"called",
"repeatedly",
"to",
"scan",
"through",
"all",
"of",
"the",
"file",
"names",
"in",
"a",
"bucket",
".",
"Each",
"time",
"you",
"call",
"it",
"returns",
"an",
"endFileName",
"that",
"can",
"be",
"used",
"as",
"the",
"starting",
"point",
"for",
"the",
"next",
"call",
"."
] |
64d25e60849f7bcb957a070af3231694da118f55
|
https://github.com/kamilZ/B2Backblaze/blob/64d25e60849f7bcb957a070af3231694da118f55/src/B2Backblaze/B2API.php#L540-L563
|
231,795
|
kamilZ/B2Backblaze
|
src/B2Backblaze/B2API.php
|
B2API.b2UploadPart
|
public function b2UploadPart($uploadURL, $token, $filePath, $minimumPartSize = 100000000)
{
$sha1s = [];
$responses = [];
$totalBytesSent = 0;
$i = 1; // current part
$bytesSentForPart = $minimumPartSize;
$fileSize = filesize($filePath);
$file = fopen($filePath, "r");
while($totalBytesSent < $fileSize) {
// Determine the number of bytes to send based on the minimum part size
if (($fileSize - $totalBytesSent) < $minimumPartSize) {
$bytesSentForPart = ($fileSize - $totalBytesSent);
}
// Get a sha1 of the part we are going to send
fseek($file, $totalBytesSent);
$data = fread($file, $bytesSentForPart);
array_push($sha1s, sha1($data));
fseek($file, $totalBytesSent);
$curl = $this->prepareCurl();
$request = new Browser($curl);
$headers = array(
'Accept' => 'application/json',
'Authorization' => $token,
'Content-Length' => $bytesSentForPart,
'X-Bz-Part-Number' => $i,
'X-Bz-Content-Sha1' => $sha1s[$i - 1],
);
$response = $request->post($uploadURL, $headers, $data);
$responses[] = new B2Response($response);
// Prepare for the next iteration of the loop
$i++;
$totalBytesSent = $bytesSentForPart + $totalBytesSent;
}
fclose($file);
return $responses;
}
|
php
|
public function b2UploadPart($uploadURL, $token, $filePath, $minimumPartSize = 100000000)
{
$sha1s = [];
$responses = [];
$totalBytesSent = 0;
$i = 1; // current part
$bytesSentForPart = $minimumPartSize;
$fileSize = filesize($filePath);
$file = fopen($filePath, "r");
while($totalBytesSent < $fileSize) {
// Determine the number of bytes to send based on the minimum part size
if (($fileSize - $totalBytesSent) < $minimumPartSize) {
$bytesSentForPart = ($fileSize - $totalBytesSent);
}
// Get a sha1 of the part we are going to send
fseek($file, $totalBytesSent);
$data = fread($file, $bytesSentForPart);
array_push($sha1s, sha1($data));
fseek($file, $totalBytesSent);
$curl = $this->prepareCurl();
$request = new Browser($curl);
$headers = array(
'Accept' => 'application/json',
'Authorization' => $token,
'Content-Length' => $bytesSentForPart,
'X-Bz-Part-Number' => $i,
'X-Bz-Content-Sha1' => $sha1s[$i - 1],
);
$response = $request->post($uploadURL, $headers, $data);
$responses[] = new B2Response($response);
// Prepare for the next iteration of the loop
$i++;
$totalBytesSent = $bytesSentForPart + $totalBytesSent;
}
fclose($file);
return $responses;
}
|
[
"public",
"function",
"b2UploadPart",
"(",
"$",
"uploadURL",
",",
"$",
"token",
",",
"$",
"filePath",
",",
"$",
"minimumPartSize",
"=",
"100000000",
")",
"{",
"$",
"sha1s",
"=",
"[",
"]",
";",
"$",
"responses",
"=",
"[",
"]",
";",
"$",
"totalBytesSent",
"=",
"0",
";",
"$",
"i",
"=",
"1",
";",
"// current part",
"$",
"bytesSentForPart",
"=",
"$",
"minimumPartSize",
";",
"$",
"fileSize",
"=",
"filesize",
"(",
"$",
"filePath",
")",
";",
"$",
"file",
"=",
"fopen",
"(",
"$",
"filePath",
",",
"\"r\"",
")",
";",
"while",
"(",
"$",
"totalBytesSent",
"<",
"$",
"fileSize",
")",
"{",
"// Determine the number of bytes to send based on the minimum part size",
"if",
"(",
"(",
"$",
"fileSize",
"-",
"$",
"totalBytesSent",
")",
"<",
"$",
"minimumPartSize",
")",
"{",
"$",
"bytesSentForPart",
"=",
"(",
"$",
"fileSize",
"-",
"$",
"totalBytesSent",
")",
";",
"}",
"// Get a sha1 of the part we are going to send",
"fseek",
"(",
"$",
"file",
",",
"$",
"totalBytesSent",
")",
";",
"$",
"data",
"=",
"fread",
"(",
"$",
"file",
",",
"$",
"bytesSentForPart",
")",
";",
"array_push",
"(",
"$",
"sha1s",
",",
"sha1",
"(",
"$",
"data",
")",
")",
";",
"fseek",
"(",
"$",
"file",
",",
"$",
"totalBytesSent",
")",
";",
"$",
"curl",
"=",
"$",
"this",
"->",
"prepareCurl",
"(",
")",
";",
"$",
"request",
"=",
"new",
"Browser",
"(",
"$",
"curl",
")",
";",
"$",
"headers",
"=",
"array",
"(",
"'Accept'",
"=>",
"'application/json'",
",",
"'Authorization'",
"=>",
"$",
"token",
",",
"'Content-Length'",
"=>",
"$",
"bytesSentForPart",
",",
"'X-Bz-Part-Number'",
"=>",
"$",
"i",
",",
"'X-Bz-Content-Sha1'",
"=>",
"$",
"sha1s",
"[",
"$",
"i",
"-",
"1",
"]",
",",
")",
";",
"$",
"response",
"=",
"$",
"request",
"->",
"post",
"(",
"$",
"uploadURL",
",",
"$",
"headers",
",",
"$",
"data",
")",
";",
"$",
"responses",
"[",
"]",
"=",
"new",
"B2Response",
"(",
"$",
"response",
")",
";",
"// Prepare for the next iteration of the loop",
"$",
"i",
"++",
";",
"$",
"totalBytesSent",
"=",
"$",
"bytesSentForPart",
"+",
"$",
"totalBytesSent",
";",
"}",
"fclose",
"(",
"$",
"file",
")",
";",
"return",
"$",
"responses",
";",
"}"
] |
b2_upload_part
Uploads one part of a large file to B2, using an file ID obtained from b2_start_large_file.
@param string $uploadURL
@param string $token
@param string $filePath
@param int $minimumPartSize The SHA1 checksum of the this part of the file. B2 will check this when the part is uploaded, to make sure that the data arrived correctly.
@return B2Response[] Example:
Part 1:
{
"contentLength": 100000000,
"contentSha1": "062685a84ab248d2488f02f6b01b948de2514ad8",
"fileId": "4_ze73ede9c9c8412db49f60715_f100b4e93fbae6252_d20150824_m224353_c900_v8881000_t0001",
"partNumber": 1
}
Part 2:
{
"contentLength": 100000000,
"contentSha1": "cf634751c3d9f6a15344f23cbf13f3fc9542addf",
"fileId": "4_ze73ede9c9c8412db49f60715_f100b4e93fbae6252_d20150824_m224353_c900_v8881000_t0001",
"partNumber": 2
}
Part 3:
{
"contentLength": 8158542,
"contentSha1": "4546018a346df683acc9a3367977de4cc8024965",
"fileId": "4_ze73ede9c9c8412db49f60715_f100b4e93fbae6252_d20150824_m224353_c900_v8881000_t0001",
"partNumber": 3
}
@throws B2Exception
|
[
"b2_upload_part",
"Uploads",
"one",
"part",
"of",
"a",
"large",
"file",
"to",
"B2",
"using",
"an",
"file",
"ID",
"obtained",
"from",
"b2_start_large_file",
"."
] |
64d25e60849f7bcb957a070af3231694da118f55
|
https://github.com/kamilZ/B2Backblaze/blob/64d25e60849f7bcb957a070af3231694da118f55/src/B2Backblaze/B2API.php#L883-L922
|
231,796
|
kamilZ/B2Backblaze
|
src/B2Backblaze/B2API.php
|
B2API.b2UpdateBucket
|
public function b2UpdateBucket($URL, $token, $bucketId, $public, $bucketInfo = null, $lifecycleRules = null, $ifRevisionIs = null)
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'accountId' => $this->accountId,
'bucketId' => $bucketId,
'bucketType' => $public ? 'allPublic' : 'allPrivate',
);
if(!is_null($bucketInfo)){
$payload["bucketInfo"] = $bucketInfo;
}
if(!is_null($lifecycleRules)){
$payload["lifecycleRules"] = $lifecycleRules;
}
if(!is_null($ifRevisionIs)){
$payload["ifRevisionIs"] = $ifRevisionIs;
}
$response = $browser->post($URL.'/b2api/v1/b2_update_bucket', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
php
|
public function b2UpdateBucket($URL, $token, $bucketId, $public, $bucketInfo = null, $lifecycleRules = null, $ifRevisionIs = null)
{
$curl = $this->prepareCurl();
$browser = new Browser($curl);
$payload = array(
'accountId' => $this->accountId,
'bucketId' => $bucketId,
'bucketType' => $public ? 'allPublic' : 'allPrivate',
);
if(!is_null($bucketInfo)){
$payload["bucketInfo"] = $bucketInfo;
}
if(!is_null($lifecycleRules)){
$payload["lifecycleRules"] = $lifecycleRules;
}
if(!is_null($ifRevisionIs)){
$payload["ifRevisionIs"] = $ifRevisionIs;
}
$response = $browser->post($URL.'/b2api/v1/b2_update_bucket', $this->getHeaders($token), json_encode($payload));
return new B2Response($response);
}
|
[
"public",
"function",
"b2UpdateBucket",
"(",
"$",
"URL",
",",
"$",
"token",
",",
"$",
"bucketId",
",",
"$",
"public",
",",
"$",
"bucketInfo",
"=",
"null",
",",
"$",
"lifecycleRules",
"=",
"null",
",",
"$",
"ifRevisionIs",
"=",
"null",
")",
"{",
"$",
"curl",
"=",
"$",
"this",
"->",
"prepareCurl",
"(",
")",
";",
"$",
"browser",
"=",
"new",
"Browser",
"(",
"$",
"curl",
")",
";",
"$",
"payload",
"=",
"array",
"(",
"'accountId'",
"=>",
"$",
"this",
"->",
"accountId",
",",
"'bucketId'",
"=>",
"$",
"bucketId",
",",
"'bucketType'",
"=>",
"$",
"public",
"?",
"'allPublic'",
":",
"'allPrivate'",
",",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"bucketInfo",
")",
")",
"{",
"$",
"payload",
"[",
"\"bucketInfo\"",
"]",
"=",
"$",
"bucketInfo",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"lifecycleRules",
")",
")",
"{",
"$",
"payload",
"[",
"\"lifecycleRules\"",
"]",
"=",
"$",
"lifecycleRules",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"ifRevisionIs",
")",
")",
"{",
"$",
"payload",
"[",
"\"ifRevisionIs\"",
"]",
"=",
"$",
"ifRevisionIs",
";",
"}",
"$",
"response",
"=",
"$",
"browser",
"->",
"post",
"(",
"$",
"URL",
".",
"'/b2api/v1/b2_update_bucket'",
",",
"$",
"this",
"->",
"getHeaders",
"(",
"$",
"token",
")",
",",
"json_encode",
"(",
"$",
"payload",
")",
")",
";",
"return",
"new",
"B2Response",
"(",
"$",
"response",
")",
";",
"}"
] |
Update an existing bucket.
Modifies the bucketType of an existing bucket. Can be used to allow everyone to download the contents
of the bucket without providing any authorization,
or to prevent anyone from downloading the contents of the bucket without providing a bucket auth token.
@param String $URL Obtained from b2_authorize_account call
@param string $token Obtained from b2_authorize_account call
@param string $bucketId The ID of the bucket
@param bool $public TRUE for public, FALSE for private.
@param null|String[] $bucketInfo User-defined information to be stored with the bucket: a JSON object mapping names to values.
@param null|String[] $lifecycleRules The list of lifecycle rules for this bucket. Structure defined below
@param null|String $ifRevisionIs When set, the update will only happen if the revision number stored in the B2 service matches the one passed in.
@return B2Response
{
"accountId" : "010203040506",
"bucketId" : "4a48fe8875c6214145260818",
"bucketInfo" : {},
"bucketName" : "any-name-you-pick",
"bucketType" : "allPrivate",
"lifecycleRules" : []
}
@throws B2Exception
|
[
"Update",
"an",
"existing",
"bucket",
"."
] |
64d25e60849f7bcb957a070af3231694da118f55
|
https://github.com/kamilZ/B2Backblaze/blob/64d25e60849f7bcb957a070af3231694da118f55/src/B2Backblaze/B2API.php#L951-L972
|
231,797
|
kamilZ/B2Backblaze
|
src/B2Backblaze/B2API.php
|
B2API.prepareCurl
|
private function prepareCurl()
{
$curl = new Curl();
$curl->setOption(CURLOPT_USERAGENT, 'B2BackblazeClient');
$curl->setVerifyPeer(false);
$curl->setTimeout($this->timeout);
return $curl;
}
|
php
|
private function prepareCurl()
{
$curl = new Curl();
$curl->setOption(CURLOPT_USERAGENT, 'B2BackblazeClient');
$curl->setVerifyPeer(false);
$curl->setTimeout($this->timeout);
return $curl;
}
|
[
"private",
"function",
"prepareCurl",
"(",
")",
"{",
"$",
"curl",
"=",
"new",
"Curl",
"(",
")",
";",
"$",
"curl",
"->",
"setOption",
"(",
"CURLOPT_USERAGENT",
",",
"'B2BackblazeClient'",
")",
";",
"$",
"curl",
"->",
"setVerifyPeer",
"(",
"false",
")",
";",
"$",
"curl",
"->",
"setTimeout",
"(",
"$",
"this",
"->",
"timeout",
")",
";",
"return",
"$",
"curl",
";",
"}"
] |
Resolve curl configuration.
@return Curl
|
[
"Resolve",
"curl",
"configuration",
"."
] |
64d25e60849f7bcb957a070af3231694da118f55
|
https://github.com/kamilZ/B2Backblaze/blob/64d25e60849f7bcb957a070af3231694da118f55/src/B2Backblaze/B2API.php#L992-L1000
|
231,798
|
joomla-framework/facebook-api
|
src/AbstractFacebookObject.php
|
AbstractFacebookObject.deleteConnection
|
public function deleteConnection($object, $connection = null, $extraFields = '')
{
if ($this->oauth->isAuthenticated())
{
// Build the request path.
if ($connection != null)
{
$path = $object . '/' . $connection . $extraFields;
}
else
{
$path = $object . $extraFields;
}
// Send the delete request.
$response = $this->oauth->query($this->fetchUrl($path), null, array(), 'delete');
return json_decode($response->body);
}
return false;
}
|
php
|
public function deleteConnection($object, $connection = null, $extraFields = '')
{
if ($this->oauth->isAuthenticated())
{
// Build the request path.
if ($connection != null)
{
$path = $object . '/' . $connection . $extraFields;
}
else
{
$path = $object . $extraFields;
}
// Send the delete request.
$response = $this->oauth->query($this->fetchUrl($path), null, array(), 'delete');
return json_decode($response->body);
}
return false;
}
|
[
"public",
"function",
"deleteConnection",
"(",
"$",
"object",
",",
"$",
"connection",
"=",
"null",
",",
"$",
"extraFields",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oauth",
"->",
"isAuthenticated",
"(",
")",
")",
"{",
"// Build the request path.",
"if",
"(",
"$",
"connection",
"!=",
"null",
")",
"{",
"$",
"path",
"=",
"$",
"object",
".",
"'/'",
".",
"$",
"connection",
".",
"$",
"extraFields",
";",
"}",
"else",
"{",
"$",
"path",
"=",
"$",
"object",
".",
"$",
"extraFields",
";",
"}",
"// Send the delete request.",
"$",
"response",
"=",
"$",
"this",
"->",
"oauth",
"->",
"query",
"(",
"$",
"this",
"->",
"fetchUrl",
"(",
"$",
"path",
")",
",",
"null",
",",
"array",
"(",
")",
",",
"'delete'",
")",
";",
"return",
"json_decode",
"(",
"$",
"response",
"->",
"body",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Method to delete a connection.
@param string $object The object id.
@param string $connection The object's connection name.
@param string $extraFields URL fields.
@return mixed The decoded JSON response or false if the client is not authenticated.
@since 1.2.0
|
[
"Method",
"to",
"delete",
"a",
"connection",
"."
] |
e7666ec1e9516f288a6f55f23a43a3d4a4edc76d
|
https://github.com/joomla-framework/facebook-api/blob/e7666ec1e9516f288a6f55f23a43a3d4a4edc76d/src/AbstractFacebookObject.php#L251-L272
|
231,799
|
praxisnetau/silverware
|
src/Forms/TagField.php
|
TagField.findOrMakeTag
|
protected function findOrMakeTag(Relation $relation, $title)
{
// Obtain Data List:
$list = $this->getList();
// Obtain Field Name:
$field = $this->getIDField();
// Obtain Existing Tag:
if ($tag = $list->find($field, $title)) {
return $tag;
}
// Create New Tag (if enabled):
if ($this->getCanCreate()) {
$tag = Injector::inst()->create($this->getTagClass($relation));
$tag->setField($field, $title)->write();
return $tag;
}
}
|
php
|
protected function findOrMakeTag(Relation $relation, $title)
{
// Obtain Data List:
$list = $this->getList();
// Obtain Field Name:
$field = $this->getIDField();
// Obtain Existing Tag:
if ($tag = $list->find($field, $title)) {
return $tag;
}
// Create New Tag (if enabled):
if ($this->getCanCreate()) {
$tag = Injector::inst()->create($this->getTagClass($relation));
$tag->setField($field, $title)->write();
return $tag;
}
}
|
[
"protected",
"function",
"findOrMakeTag",
"(",
"Relation",
"$",
"relation",
",",
"$",
"title",
")",
"{",
"// Obtain Data List:",
"$",
"list",
"=",
"$",
"this",
"->",
"getList",
"(",
")",
";",
"// Obtain Field Name:",
"$",
"field",
"=",
"$",
"this",
"->",
"getIDField",
"(",
")",
";",
"// Obtain Existing Tag:",
"if",
"(",
"$",
"tag",
"=",
"$",
"list",
"->",
"find",
"(",
"$",
"field",
",",
"$",
"title",
")",
")",
"{",
"return",
"$",
"tag",
";",
"}",
"// Create New Tag (if enabled):",
"if",
"(",
"$",
"this",
"->",
"getCanCreate",
"(",
")",
")",
"{",
"$",
"tag",
"=",
"Injector",
"::",
"inst",
"(",
")",
"->",
"create",
"(",
"$",
"this",
"->",
"getTagClass",
"(",
"$",
"relation",
")",
")",
";",
"$",
"tag",
"->",
"setField",
"(",
"$",
"field",
",",
"$",
"title",
")",
"->",
"write",
"(",
")",
";",
"return",
"$",
"tag",
";",
"}",
"}"
] |
Obtains or creates a tag object with the given title.
@param Relation $relation
@param string $title
@return Tag
|
[
"Obtains",
"or",
"creates",
"a",
"tag",
"object",
"with",
"the",
"given",
"title",
"."
] |
2fa731c7f0737b350e0cbc676e93ac5beb430792
|
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Forms/TagField.php#L207-L230
|
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.