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 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
norkunas/onesignal-php-api | src/Devices.php | Devices.getAll | public function getAll($limit = self::DEVICES_LIMIT, $offset = 0)
{
$query = [
'limit' => max(1, min(self::DEVICES_LIMIT, filter_var($limit, FILTER_VALIDATE_INT))),
'offset' => max(0, filter_var($offset, FILTER_VALIDATE_INT)),
'app_id' => $this->api->getConfig()->getApplicationId(),
];
return $this->api->request('GET', '/players?'.http_build_query($query), [
'Authorization' => 'Basic '.$this->api->getConfig()->getApplicationAuthKey(),
]);
} | php | public function getAll($limit = self::DEVICES_LIMIT, $offset = 0)
{
$query = [
'limit' => max(1, min(self::DEVICES_LIMIT, filter_var($limit, FILTER_VALIDATE_INT))),
'offset' => max(0, filter_var($offset, FILTER_VALIDATE_INT)),
'app_id' => $this->api->getConfig()->getApplicationId(),
];
return $this->api->request('GET', '/players?'.http_build_query($query), [
'Authorization' => 'Basic '.$this->api->getConfig()->getApplicationAuthKey(),
]);
} | [
"public",
"function",
"getAll",
"(",
"$",
"limit",
"=",
"self",
"::",
"DEVICES_LIMIT",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"$",
"query",
"=",
"[",
"'limit'",
"=>",
"max",
"(",
"1",
",",
"min",
"(",
"self",
"::",
"DEVICES_LIMIT",
",",
"filter_var"... | Get information about all registered devices for your application.
Application auth key must be set.
@param int $limit How many devices to return. Max is 300. Default is 300
@param int $offset Result offset. Default is 0. Results are sorted by id
@return array | [
"Get",
"information",
"about",
"all",
"registered",
"devices",
"for",
"your",
"application",
"."
] | 0d9e35fdbfa5c05864d14baed381cd1cda37c8b1 | https://github.com/norkunas/onesignal-php-api/blob/0d9e35fdbfa5c05864d14baed381cd1cda37c8b1/src/Devices.php#L73-L84 | train |
norkunas/onesignal-php-api | src/Devices.php | Devices.add | public function add(array $data)
{
$data = $this->resolverFactory->createNewDeviceResolver()->resolve($data);
return $this->api->request('POST', '/players', [], json_encode($data));
} | php | public function add(array $data)
{
$data = $this->resolverFactory->createNewDeviceResolver()->resolve($data);
return $this->api->request('POST', '/players', [], json_encode($data));
} | [
"public",
"function",
"add",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"resolverFactory",
"->",
"createNewDeviceResolver",
"(",
")",
"->",
"resolve",
"(",
"$",
"data",
")",
";",
"return",
"$",
"this",
"->",
"api",
"->",
... | Register a device for your application.
@param array $data Device data
@return array | [
"Register",
"a",
"device",
"for",
"your",
"application",
"."
] | 0d9e35fdbfa5c05864d14baed381cd1cda37c8b1 | https://github.com/norkunas/onesignal-php-api/blob/0d9e35fdbfa5c05864d14baed381cd1cda37c8b1/src/Devices.php#L93-L98 | train |
norkunas/onesignal-php-api | src/Devices.php | Devices.update | public function update($id, array $data)
{
$data = $this->resolverFactory->createExistingDeviceResolver()->resolve($data);
return $this->api->request('PUT', '/players/'.$id, [], json_encode($data));
} | php | public function update($id, array $data)
{
$data = $this->resolverFactory->createExistingDeviceResolver()->resolve($data);
return $this->api->request('PUT', '/players/'.$id, [], json_encode($data));
} | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"array",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"resolverFactory",
"->",
"createExistingDeviceResolver",
"(",
")",
"->",
"resolve",
"(",
"$",
"data",
")",
";",
"return",
"$",
"th... | Update existing registered device for your application with provided data.
@param string $id Device ID
@param array $data New device data
@return array | [
"Update",
"existing",
"registered",
"device",
"for",
"your",
"application",
"with",
"provided",
"data",
"."
] | 0d9e35fdbfa5c05864d14baed381cd1cda37c8b1 | https://github.com/norkunas/onesignal-php-api/blob/0d9e35fdbfa5c05864d14baed381cd1cda37c8b1/src/Devices.php#L108-L113 | train |
norkunas/onesignal-php-api | src/Devices.php | Devices.delete | public function delete($id)
{
$query = [
'app_id' => $this->api->getConfig()->getApplicationId(),
];
return $this->api->request('DELETE', '/players/'.$id.'?'.http_build_query($query), [
'Authorization' => 'Basic '.$this->api->getConfig()->getApplicationAuthKey(),
]);
} | php | public function delete($id)
{
$query = [
'app_id' => $this->api->getConfig()->getApplicationId(),
];
return $this->api->request('DELETE', '/players/'.$id.'?'.http_build_query($query), [
'Authorization' => 'Basic '.$this->api->getConfig()->getApplicationAuthKey(),
]);
} | [
"public",
"function",
"delete",
"(",
"$",
"id",
")",
"{",
"$",
"query",
"=",
"[",
"'app_id'",
"=>",
"$",
"this",
"->",
"api",
"->",
"getConfig",
"(",
")",
"->",
"getApplicationId",
"(",
")",
",",
"]",
";",
"return",
"$",
"this",
"->",
"api",
"->",
... | Delete existing registered device from your application.
OneSignal supports DELETE on the players API endpoint which is not documented in their official documentation
Reference: https://documentation.onesignal.com/docs/handling-personal-data#section-deleting-users-or-other-data-from-onesignal
Application auth key must be set.
@param string $id Device ID
@return array | [
"Delete",
"existing",
"registered",
"device",
"from",
"your",
"application",
"."
] | 0d9e35fdbfa5c05864d14baed381cd1cda37c8b1 | https://github.com/norkunas/onesignal-php-api/blob/0d9e35fdbfa5c05864d14baed381cd1cda37c8b1/src/Devices.php#L127-L136 | train |
norkunas/onesignal-php-api | src/Devices.php | Devices.onSession | public function onSession($id, array $data)
{
$data = $this->resolverFactory->createDeviceSessionResolver()->resolve($data);
return $this->api->request('POST', '/players/'.$id.'/on_session', [], json_encode($data));
} | php | public function onSession($id, array $data)
{
$data = $this->resolverFactory->createDeviceSessionResolver()->resolve($data);
return $this->api->request('POST', '/players/'.$id.'/on_session', [], json_encode($data));
} | [
"public",
"function",
"onSession",
"(",
"$",
"id",
",",
"array",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"resolverFactory",
"->",
"createDeviceSessionResolver",
"(",
")",
"->",
"resolve",
"(",
"$",
"data",
")",
";",
"return",
"$",
"... | Call on new device session in your app.
@param string $id Device ID
@param array $data Device data
@return array | [
"Call",
"on",
"new",
"device",
"session",
"in",
"your",
"app",
"."
] | 0d9e35fdbfa5c05864d14baed381cd1cda37c8b1 | https://github.com/norkunas/onesignal-php-api/blob/0d9e35fdbfa5c05864d14baed381cd1cda37c8b1/src/Devices.php#L146-L151 | train |
norkunas/onesignal-php-api | src/Devices.php | Devices.onPurchase | public function onPurchase($id, array $data)
{
$data = $this->resolverFactory->createDevicePurchaseResolver()->resolve($data);
return $this->api->request('POST', '/players/'.$id.'/on_purchase', [], json_encode($data));
} | php | public function onPurchase($id, array $data)
{
$data = $this->resolverFactory->createDevicePurchaseResolver()->resolve($data);
return $this->api->request('POST', '/players/'.$id.'/on_purchase', [], json_encode($data));
} | [
"public",
"function",
"onPurchase",
"(",
"$",
"id",
",",
"array",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"resolverFactory",
"->",
"createDevicePurchaseResolver",
"(",
")",
"->",
"resolve",
"(",
"$",
"data",
")",
";",
"return",
"$",
... | Track a new purchase.
@param string $id Device ID
@param array $data Device data
@return array | [
"Track",
"a",
"new",
"purchase",
"."
] | 0d9e35fdbfa5c05864d14baed381cd1cda37c8b1 | https://github.com/norkunas/onesignal-php-api/blob/0d9e35fdbfa5c05864d14baed381cd1cda37c8b1/src/Devices.php#L161-L166 | train |
norkunas/onesignal-php-api | src/Devices.php | Devices.onFocus | public function onFocus($id, array $data)
{
$data = $this->resolverFactory->createDeviceFocusResolver()->resolve($data);
return $this->api->request('POST', '/players/'.$id.'/on_focus', [], json_encode($data));
} | php | public function onFocus($id, array $data)
{
$data = $this->resolverFactory->createDeviceFocusResolver()->resolve($data);
return $this->api->request('POST', '/players/'.$id.'/on_focus', [], json_encode($data));
} | [
"public",
"function",
"onFocus",
"(",
"$",
"id",
",",
"array",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"resolverFactory",
"->",
"createDeviceFocusResolver",
"(",
")",
"->",
"resolve",
"(",
"$",
"data",
")",
";",
"return",
"$",
"this... | Increment the device's total session length.
@param string $id Device ID
@param array $data Device data
@return array | [
"Increment",
"the",
"device",
"s",
"total",
"session",
"length",
"."
] | 0d9e35fdbfa5c05864d14baed381cd1cda37c8b1 | https://github.com/norkunas/onesignal-php-api/blob/0d9e35fdbfa5c05864d14baed381cd1cda37c8b1/src/Devices.php#L176-L181 | train |
norkunas/onesignal-php-api | src/Devices.php | Devices.csvExport | public function csvExport(array $extraFields = [])
{
$url = '/players/csv_export?app_id='.$this->api->getConfig()->getApplicationId();
$headers = [
'Authorization' => 'Basic '.$this->api->getConfig()->getApplicationAuthKey(),
];
$body = [
'extra_fields' => $extraFields,
];
return $this->api->request('POST', $url, $headers, json_encode($body));
} | php | public function csvExport(array $extraFields = [])
{
$url = '/players/csv_export?app_id='.$this->api->getConfig()->getApplicationId();
$headers = [
'Authorization' => 'Basic '.$this->api->getConfig()->getApplicationAuthKey(),
];
$body = [
'extra_fields' => $extraFields,
];
return $this->api->request('POST', $url, $headers, json_encode($body));
} | [
"public",
"function",
"csvExport",
"(",
"array",
"$",
"extraFields",
"=",
"[",
"]",
")",
"{",
"$",
"url",
"=",
"'/players/csv_export?app_id='",
".",
"$",
"this",
"->",
"api",
"->",
"getConfig",
"(",
")",
"->",
"getApplicationId",
"(",
")",
";",
"$",
"hea... | Export all information about devices in a CSV format for your application.
Application auth key must be set.
@param array $extraFields Additional fields that you wish to include.
Currently supports: "location", "country", "rooted"
@return array | [
"Export",
"all",
"information",
"about",
"devices",
"in",
"a",
"CSV",
"format",
"for",
"your",
"application",
"."
] | 0d9e35fdbfa5c05864d14baed381cd1cda37c8b1 | https://github.com/norkunas/onesignal-php-api/blob/0d9e35fdbfa5c05864d14baed381cd1cda37c8b1/src/Devices.php#L193-L206 | train |
norkunas/onesignal-php-api | src/Notifications.php | Notifications.getOne | public function getOne($id)
{
$url = '/notifications/'.$id.'?app_id='.$this->api->getConfig()->getApplicationId();
return $this->api->request('GET', $url, [
'Authorization' => 'Basic '.$this->api->getConfig()->getApplicationAuthKey(),
]);
} | php | public function getOne($id)
{
$url = '/notifications/'.$id.'?app_id='.$this->api->getConfig()->getApplicationId();
return $this->api->request('GET', $url, [
'Authorization' => 'Basic '.$this->api->getConfig()->getApplicationAuthKey(),
]);
} | [
"public",
"function",
"getOne",
"(",
"$",
"id",
")",
"{",
"$",
"url",
"=",
"'/notifications/'",
".",
"$",
"id",
".",
"'?app_id='",
".",
"$",
"this",
"->",
"api",
"->",
"getConfig",
"(",
")",
"->",
"getApplicationId",
"(",
")",
";",
"return",
"$",
"th... | Get information about notification with provided ID.
Application authentication key and ID must be set.
@param string $id Notification ID
@return array | [
"Get",
"information",
"about",
"notification",
"with",
"provided",
"ID",
"."
] | 0d9e35fdbfa5c05864d14baed381cd1cda37c8b1 | https://github.com/norkunas/onesignal-php-api/blob/0d9e35fdbfa5c05864d14baed381cd1cda37c8b1/src/Notifications.php#L30-L37 | train |
norkunas/onesignal-php-api | src/Notifications.php | Notifications.add | public function add(array $data)
{
$data = $this->resolverFactory->createNotificationResolver()->resolve($data);
return $this->api->request('POST', '/notifications', [
'Authorization' => 'Basic '.$this->api->getConfig()->getApplicationAuthKey(),
], json_encode($data));
} | php | public function add(array $data)
{
$data = $this->resolverFactory->createNotificationResolver()->resolve($data);
return $this->api->request('POST', '/notifications', [
'Authorization' => 'Basic '.$this->api->getConfig()->getApplicationAuthKey(),
], json_encode($data));
} | [
"public",
"function",
"add",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"resolverFactory",
"->",
"createNotificationResolver",
"(",
")",
"->",
"resolve",
"(",
"$",
"data",
")",
";",
"return",
"$",
"this",
"->",
"api",
"->... | Send new notification with provided data.
Application authentication key and ID must be set.
@param array $data
@return array | [
"Send",
"new",
"notification",
"with",
"provided",
"data",
"."
] | 0d9e35fdbfa5c05864d14baed381cd1cda37c8b1 | https://github.com/norkunas/onesignal-php-api/blob/0d9e35fdbfa5c05864d14baed381cd1cda37c8b1/src/Notifications.php#L71-L78 | train |
norkunas/onesignal-php-api | src/Notifications.php | Notifications.open | public function open($id)
{
return $this->api->request('PUT', '/notifications/'.$id, [
'Authorization' => 'Basic '.$this->api->getConfig()->getApplicationAuthKey(),
], json_encode([
'app_id' => $this->api->getConfig()->getApplicationId(),
'opened' => true,
]));
} | php | public function open($id)
{
return $this->api->request('PUT', '/notifications/'.$id, [
'Authorization' => 'Basic '.$this->api->getConfig()->getApplicationAuthKey(),
], json_encode([
'app_id' => $this->api->getConfig()->getApplicationId(),
'opened' => true,
]));
} | [
"public",
"function",
"open",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"api",
"->",
"request",
"(",
"'PUT'",
",",
"'/notifications/'",
".",
"$",
"id",
",",
"[",
"'Authorization'",
"=>",
"'Basic '",
".",
"$",
"this",
"->",
"api",
"->",
"... | Open notification.
Application authentication key and ID must be set.
@param string $id Notification ID
@return array | [
"Open",
"notification",
"."
] | 0d9e35fdbfa5c05864d14baed381cd1cda37c8b1 | https://github.com/norkunas/onesignal-php-api/blob/0d9e35fdbfa5c05864d14baed381cd1cda37c8b1/src/Notifications.php#L89-L97 | train |
lokielse/omnipay-alipay | src/Common/Signer.php | Signer.format | public function format($key, $type)
{
if (is_file($key)) {
$key = file_get_contents($key);
}
if (is_string($key) && strpos($key, '-----') === false) {
$key = $this->convertKey($key, $type);
}
return $key;
} | php | public function format($key, $type)
{
if (is_file($key)) {
$key = file_get_contents($key);
}
if (is_string($key) && strpos($key, '-----') === false) {
$key = $this->convertKey($key, $type);
}
return $key;
} | [
"public",
"function",
"format",
"(",
"$",
"key",
",",
"$",
"type",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"file_get_contents",
"(",
"$",
"key",
")",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"key",
")... | Convert key to standard format
@param $key
@param $type
@return string | [
"Convert",
"key",
"to",
"standard",
"format"
] | 39a017371c742d877bb18d74608bc1063b0d5c24 | https://github.com/lokielse/omnipay-alipay/blob/39a017371c742d877bb18d74608bc1063b0d5c24/src/Common/Signer.php#L187-L198 | train |
lokielse/omnipay-alipay | src/Common/Signer.php | Signer.convertKey | public function convertKey($key, $type)
{
$lines = [];
if ($type == self::KEY_TYPE_PUBLIC) {
$lines[] = '-----BEGIN PUBLIC KEY-----';
} else {
$lines[] = '-----BEGIN RSA PRIVATE KEY-----';
}
for ($i = 0; $i < strlen($key); $i += 64) {
$lines[] = trim(substr($key, $i, 64));
}
if ($type == self::KEY_TYPE_PUBLIC) {
$lines[] = '-----END PUBLIC KEY-----';
} else {
$lines[] = '-----END RSA PRIVATE KEY-----';
}
return implode("\n", $lines);
} | php | public function convertKey($key, $type)
{
$lines = [];
if ($type == self::KEY_TYPE_PUBLIC) {
$lines[] = '-----BEGIN PUBLIC KEY-----';
} else {
$lines[] = '-----BEGIN RSA PRIVATE KEY-----';
}
for ($i = 0; $i < strlen($key); $i += 64) {
$lines[] = trim(substr($key, $i, 64));
}
if ($type == self::KEY_TYPE_PUBLIC) {
$lines[] = '-----END PUBLIC KEY-----';
} else {
$lines[] = '-----END RSA PRIVATE KEY-----';
}
return implode("\n", $lines);
} | [
"public",
"function",
"convertKey",
"(",
"$",
"key",
",",
"$",
"type",
")",
"{",
"$",
"lines",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"type",
"==",
"self",
"::",
"KEY_TYPE_PUBLIC",
")",
"{",
"$",
"lines",
"[",
"]",
"=",
"'-----BEGIN PUBLIC KEY-----'",
"... | Convert one line key to standard format
@param $key
@param $type
@return string | [
"Convert",
"one",
"line",
"key",
"to",
"standard",
"format"
] | 39a017371c742d877bb18d74608bc1063b0d5c24 | https://github.com/lokielse/omnipay-alipay/blob/39a017371c742d877bb18d74608bc1063b0d5c24/src/Common/Signer.php#L209-L230 | train |
lokielse/omnipay-alipay | src/Responses/LegacyQueryResponse.php | LegacyQueryResponse.isPaid | public function isPaid()
{
$response = array_get($this->data, 'response');
if ($response) {
$trade = array_get($response, 'trade');
if (array_get($trade, 'trade_status')) {
if (array_get($trade, 'trade_status') == 'TRADE_SUCCESS') {
return true;
} elseif (array_get($trade, 'trade_status') == 'TRADE_FINISHED') {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
} | php | public function isPaid()
{
$response = array_get($this->data, 'response');
if ($response) {
$trade = array_get($response, 'trade');
if (array_get($trade, 'trade_status')) {
if (array_get($trade, 'trade_status') == 'TRADE_SUCCESS') {
return true;
} elseif (array_get($trade, 'trade_status') == 'TRADE_FINISHED') {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
} | [
"public",
"function",
"isPaid",
"(",
")",
"{",
"$",
"response",
"=",
"array_get",
"(",
"$",
"this",
"->",
"data",
",",
"'response'",
")",
";",
"if",
"(",
"$",
"response",
")",
"{",
"$",
"trade",
"=",
"array_get",
"(",
"$",
"response",
",",
"'trade'",... | Is the trade paid?
@return boolean | [
"Is",
"the",
"trade",
"paid?"
] | 39a017371c742d877bb18d74608bc1063b0d5c24 | https://github.com/lokielse/omnipay-alipay/blob/39a017371c742d877bb18d74608bc1063b0d5c24/src/Responses/LegacyQueryResponse.php#L23-L42 | train |
phingofficial/phing | classes/phing/types/Reference.php | Reference.getReferencedObject | public function getReferencedObject(Project $fallback = null)
{
$project = $fallback ?? $this->project;
if ($this->refid === null) {
throw new BuildException("No reference specified");
}
$o = $project->getReference($this->refid);
if ($o === null) {
throw new BuildException("Reference {$this->refid} not found.");
}
return $o;
} | php | public function getReferencedObject(Project $fallback = null)
{
$project = $fallback ?? $this->project;
if ($this->refid === null) {
throw new BuildException("No reference specified");
}
$o = $project->getReference($this->refid);
if ($o === null) {
throw new BuildException("Reference {$this->refid} not found.");
}
return $o;
} | [
"public",
"function",
"getReferencedObject",
"(",
"Project",
"$",
"fallback",
"=",
"null",
")",
"{",
"$",
"project",
"=",
"$",
"fallback",
"??",
"$",
"this",
"->",
"project",
";",
"if",
"(",
"$",
"this",
"->",
"refid",
"===",
"null",
")",
"{",
"throw",... | returns reference to object in references container of project
@param Project|null $fallback
@return object | [
"returns",
"reference",
"to",
"object",
"in",
"references",
"container",
"of",
"project"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/Reference.php#L84-L97 | train |
phingofficial/phing | classes/phing/tasks/system/condition/ContainsCondition.php | ContainsCondition.evaluate | public function evaluate()
{
if ($this->string === null || $this->subString === null) {
throw new BuildException(
"both string and substring are required "
. "in contains"
);
}
return $this->caseSensitive
? strpos($this->string, $this->subString) !== false
: stripos($this->string, $this->subString) !== false;
} | php | public function evaluate()
{
if ($this->string === null || $this->subString === null) {
throw new BuildException(
"both string and substring are required "
. "in contains"
);
}
return $this->caseSensitive
? strpos($this->string, $this->subString) !== false
: stripos($this->string, $this->subString) !== false;
} | [
"public",
"function",
"evaluate",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"string",
"===",
"null",
"||",
"$",
"this",
"->",
"subString",
"===",
"null",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"both string and substring are required \"",
".",
... | Check whether string contains substring.
@throws BuildException | [
"Check",
"whether",
"string",
"contains",
"substring",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/condition/ContainsCondition.php#L70-L82 | train |
phingofficial/phing | classes/phing/tasks/ext/pdo/DefaultPDOQuerySplitter.php | DefaultPDOQuerySplitter.nextQuery | public function nextQuery()
{
$sql = "";
$hasQuery = false;
while (($line = $this->sqlReader->readLine()) !== null) {
$delimiter = $this->parent->getDelimiter();
$project = $this->parent->getOwningTarget()->getProject();
$line = $project->replaceProperties(trim($line));
if (($line != $delimiter) && (StringHelper::startsWith("//", $line)
|| StringHelper::startsWith("--", $line)
|| StringHelper::startsWith("#", $line))
) {
continue;
}
if (strlen($line) > 4
&& strtoupper(substr($line, 0, 4)) == "REM "
) {
continue;
}
// MySQL supports defining new delimiters
if (preg_match('/DELIMITER [\'"]?([^\'" $]+)[\'"]?/i', $line, $matches)) {
$this->parent->setDelimiter($matches[1]);
continue;
}
if ($this->sqlBacklog !== "") {
$sql = $this->sqlBacklog;
$this->sqlBacklog = "";
}
$sql .= " " . $line . "\n";
// SQL defines "--" as a comment to EOL
// and in Oracle it may contain a hint
// so we cannot just remove it, instead we must end it
if (strpos($line, "--") !== false) {
$sql .= "\n";
}
// DELIM_ROW doesn't need this (as far as i can tell)
if ($this->delimiterType == PDOSQLExecTask::DELIM_NORMAL) {
$reg = "#((?:\"(?:\\\\.|[^\"])*\"?)+|'(?:\\\\.|[^'])*'?|" . preg_quote($delimiter) . ")#";
$sqlParts = preg_split($reg, $sql, 0, PREG_SPLIT_DELIM_CAPTURE);
$this->sqlBacklog = "";
foreach ($sqlParts as $sqlPart) {
// we always want to append, even if it's a delim (which will be stripped off later)
$this->sqlBacklog .= $sqlPart;
// we found a single (not enclosed by ' or ") delimiter, so we can use all stuff before the delim as the actual query
if ($sqlPart === $delimiter) {
$sql = $this->sqlBacklog;
$this->sqlBacklog = "";
$hasQuery = true;
}
}
}
if ($hasQuery || ($this->delimiterType == PDOSQLExecTask::DELIM_ROW && $line == $delimiter)) {
// this assumes there is always a delimter on the end of the SQL statement.
$sql = StringHelper::substring(
$sql,
0,
strlen($sql) - strlen($delimiter)
- ($this->delimiterType == PDOSQLExecTask::DELIM_ROW ? 2 : 1)
);
return $sql;
}
}
// Catch any statements not followed by ;
if ($sql !== "") {
return $sql;
}
return null;
} | php | public function nextQuery()
{
$sql = "";
$hasQuery = false;
while (($line = $this->sqlReader->readLine()) !== null) {
$delimiter = $this->parent->getDelimiter();
$project = $this->parent->getOwningTarget()->getProject();
$line = $project->replaceProperties(trim($line));
if (($line != $delimiter) && (StringHelper::startsWith("//", $line)
|| StringHelper::startsWith("--", $line)
|| StringHelper::startsWith("#", $line))
) {
continue;
}
if (strlen($line) > 4
&& strtoupper(substr($line, 0, 4)) == "REM "
) {
continue;
}
// MySQL supports defining new delimiters
if (preg_match('/DELIMITER [\'"]?([^\'" $]+)[\'"]?/i', $line, $matches)) {
$this->parent->setDelimiter($matches[1]);
continue;
}
if ($this->sqlBacklog !== "") {
$sql = $this->sqlBacklog;
$this->sqlBacklog = "";
}
$sql .= " " . $line . "\n";
// SQL defines "--" as a comment to EOL
// and in Oracle it may contain a hint
// so we cannot just remove it, instead we must end it
if (strpos($line, "--") !== false) {
$sql .= "\n";
}
// DELIM_ROW doesn't need this (as far as i can tell)
if ($this->delimiterType == PDOSQLExecTask::DELIM_NORMAL) {
$reg = "#((?:\"(?:\\\\.|[^\"])*\"?)+|'(?:\\\\.|[^'])*'?|" . preg_quote($delimiter) . ")#";
$sqlParts = preg_split($reg, $sql, 0, PREG_SPLIT_DELIM_CAPTURE);
$this->sqlBacklog = "";
foreach ($sqlParts as $sqlPart) {
// we always want to append, even if it's a delim (which will be stripped off later)
$this->sqlBacklog .= $sqlPart;
// we found a single (not enclosed by ' or ") delimiter, so we can use all stuff before the delim as the actual query
if ($sqlPart === $delimiter) {
$sql = $this->sqlBacklog;
$this->sqlBacklog = "";
$hasQuery = true;
}
}
}
if ($hasQuery || ($this->delimiterType == PDOSQLExecTask::DELIM_ROW && $line == $delimiter)) {
// this assumes there is always a delimter on the end of the SQL statement.
$sql = StringHelper::substring(
$sql,
0,
strlen($sql) - strlen($delimiter)
- ($this->delimiterType == PDOSQLExecTask::DELIM_ROW ? 2 : 1)
);
return $sql;
}
}
// Catch any statements not followed by ;
if ($sql !== "") {
return $sql;
}
return null;
} | [
"public",
"function",
"nextQuery",
"(",
")",
"{",
"$",
"sql",
"=",
"\"\"",
";",
"$",
"hasQuery",
"=",
"false",
";",
"while",
"(",
"(",
"$",
"line",
"=",
"$",
"this",
"->",
"sqlReader",
"->",
"readLine",
"(",
")",
")",
"!==",
"null",
")",
"{",
"$"... | Returns next query from SQL source, null if no more queries left
In case of "row" delimiter type this searches for strings containing only
delimiters. In case of "normal" delimiter type, this uses simple regular
expression logic to search for delimiters.
@return string|null | [
"Returns",
"next",
"query",
"from",
"SQL",
"source",
"null",
"if",
"no",
"more",
"queries",
"left"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdo/DefaultPDOQuerySplitter.php#L72-L153 | train |
phingofficial/phing | classes/phing/listener/MailLogger.php | MailLogger.buildFinished | public function buildFinished(BuildEvent $event)
{
parent::buildFinished($event);
$project = $event->getProject();
$properties = $project->getProperties();
$filename = $properties['phing.log.mail.properties.file'];
// overlay specified properties file (if any), which overrides project
// settings
$fileProperties = new Properties();
$file = new PhingFile($filename);
try {
$fileProperties->load($file);
} catch (IOException $ioe) {
// ignore because properties file is not required
}
foreach ($fileProperties as $key => $value) {
$properties['key'] = $project->replaceProperties($value);
}
$success = $event->getException() === null;
$prefix = $success ? 'success' : 'failure';
try {
$notify = StringHelper::booleanValue($this->getValue($properties, $prefix . '.notify', 'on'));
if (!$notify) {
return;
}
if (is_string(Phing::getDefinedProperty('phing.log.mail.subject'))) {
$defaultSubject = Phing::getDefinedProperty('phing.log.mail.subject');
} else {
$defaultSubject = ($success) ? 'Build Success' : 'Build Failure';
}
$hdrs = [];
$hdrs['From'] = $this->getValue($properties, 'from', $this->from);
$hdrs['Reply-To'] = $this->getValue($properties, 'replyto', '');
$hdrs['Cc'] = $this->getValue($properties, $prefix . '.cc', '');
$hdrs['Bcc'] = $this->getValue($properties, $prefix . '.bcc', '');
$hdrs['Body'] = $this->getValue($properties, $prefix . '.body', '');
$hdrs['Subject'] = $this->getValue($properties, $prefix . '.subject', $defaultSubject);
$tolist = $this->getValue($properties, $prefix . '.to', $this->tolist);
} catch (BadMethodCallException $e) {
$project->log($e->getMessage(), Project::MSG_WARN);
}
if (empty($tolist)) {
return;
}
$mail = Mail::factory('mail');
$mail->send($tolist, $hdrs, $this->mailMessage);
} | php | public function buildFinished(BuildEvent $event)
{
parent::buildFinished($event);
$project = $event->getProject();
$properties = $project->getProperties();
$filename = $properties['phing.log.mail.properties.file'];
// overlay specified properties file (if any), which overrides project
// settings
$fileProperties = new Properties();
$file = new PhingFile($filename);
try {
$fileProperties->load($file);
} catch (IOException $ioe) {
// ignore because properties file is not required
}
foreach ($fileProperties as $key => $value) {
$properties['key'] = $project->replaceProperties($value);
}
$success = $event->getException() === null;
$prefix = $success ? 'success' : 'failure';
try {
$notify = StringHelper::booleanValue($this->getValue($properties, $prefix . '.notify', 'on'));
if (!$notify) {
return;
}
if (is_string(Phing::getDefinedProperty('phing.log.mail.subject'))) {
$defaultSubject = Phing::getDefinedProperty('phing.log.mail.subject');
} else {
$defaultSubject = ($success) ? 'Build Success' : 'Build Failure';
}
$hdrs = [];
$hdrs['From'] = $this->getValue($properties, 'from', $this->from);
$hdrs['Reply-To'] = $this->getValue($properties, 'replyto', '');
$hdrs['Cc'] = $this->getValue($properties, $prefix . '.cc', '');
$hdrs['Bcc'] = $this->getValue($properties, $prefix . '.bcc', '');
$hdrs['Body'] = $this->getValue($properties, $prefix . '.body', '');
$hdrs['Subject'] = $this->getValue($properties, $prefix . '.subject', $defaultSubject);
$tolist = $this->getValue($properties, $prefix . '.to', $this->tolist);
} catch (BadMethodCallException $e) {
$project->log($e->getMessage(), Project::MSG_WARN);
}
if (empty($tolist)) {
return;
}
$mail = Mail::factory('mail');
$mail->send($tolist, $hdrs, $this->mailMessage);
} | [
"public",
"function",
"buildFinished",
"(",
"BuildEvent",
"$",
"event",
")",
"{",
"parent",
"::",
"buildFinished",
"(",
"$",
"event",
")",
";",
"$",
"project",
"=",
"$",
"event",
"->",
"getProject",
"(",
")",
";",
"$",
"properties",
"=",
"$",
"project",
... | Sends the mail
@see DefaultLogger#buildFinished
@param BuildEvent $event | [
"Sends",
"the",
"mail"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/listener/MailLogger.php#L72-L128 | train |
phingofficial/phing | classes/phing/tasks/ext/pdo/PDOSQLExecFormatterElement.php | PDOSQLExecFormatterElement.getOutputWriter | private function getOutputWriter()
{
if ($this->useFile) {
$of = $this->getOutfile();
if (!$of) {
$of = new PhingFile($this->formatter->getPreferredOutfile());
}
return new FileWriter($of, $this->append);
} else {
return $this->getDefaultOutput();
}
} | php | private function getOutputWriter()
{
if ($this->useFile) {
$of = $this->getOutfile();
if (!$of) {
$of = new PhingFile($this->formatter->getPreferredOutfile());
}
return new FileWriter($of, $this->append);
} else {
return $this->getDefaultOutput();
}
} | [
"private",
"function",
"getOutputWriter",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useFile",
")",
"{",
"$",
"of",
"=",
"$",
"this",
"->",
"getOutfile",
"(",
")",
";",
"if",
"(",
"!",
"$",
"of",
")",
"{",
"$",
"of",
"=",
"new",
"PhingFile",
... | Gets a configured output writer.
@return Writer | [
"Gets",
"a",
"configured",
"output",
"writer",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdo/PDOSQLExecFormatterElement.php#L150-L162 | train |
phingofficial/phing | classes/phing/tasks/ext/pdo/PDOSQLExecFormatterElement.php | PDOSQLExecFormatterElement.prepare | public function prepare(Location $location)
{
if (!$this->formatter) {
throw new BuildException("No formatter specified (use type or classname attribute)", $location);
}
$out = $this->getOutputWriter();
$this->parentTask->log("Setting output writer to: " . get_class($out), Project::MSG_VERBOSE);
$this->formatter->setOutput($out);
if ($this->formatter instanceof PlainPDOResultFormatter) {
// set any options that apply to the plain formatter
$this->formatter->setShowheaders($this->showheaders);
$this->formatter->setRowdelim($this->rowdelimiter);
$this->formatter->setColdelim($this->coldelimiter);
} elseif ($this->formatter instanceof XMLPDOResultFormatter) {
// set any options that apply to the xml formatter
$this->formatter->setEncoding($this->encoding);
$this->formatter->setFormatOutput($this->formatoutput);
}
foreach ($this->formatterParams as $param) {
$param = new Parameter();
$method = 'set' . $param->getName();
if (!method_exists($this->formatter, $param->getName())) {
throw new BuildException(
"Formatter " . get_class(
$this->formatter
) . " does not have a $method method.",
$location
);
}
call_user_func([$this->formatter, $method], $param->getValue());
}
} | php | public function prepare(Location $location)
{
if (!$this->formatter) {
throw new BuildException("No formatter specified (use type or classname attribute)", $location);
}
$out = $this->getOutputWriter();
$this->parentTask->log("Setting output writer to: " . get_class($out), Project::MSG_VERBOSE);
$this->formatter->setOutput($out);
if ($this->formatter instanceof PlainPDOResultFormatter) {
// set any options that apply to the plain formatter
$this->formatter->setShowheaders($this->showheaders);
$this->formatter->setRowdelim($this->rowdelimiter);
$this->formatter->setColdelim($this->coldelimiter);
} elseif ($this->formatter instanceof XMLPDOResultFormatter) {
// set any options that apply to the xml formatter
$this->formatter->setEncoding($this->encoding);
$this->formatter->setFormatOutput($this->formatoutput);
}
foreach ($this->formatterParams as $param) {
$param = new Parameter();
$method = 'set' . $param->getName();
if (!method_exists($this->formatter, $param->getName())) {
throw new BuildException(
"Formatter " . get_class(
$this->formatter
) . " does not have a $method method.",
$location
);
}
call_user_func([$this->formatter, $method], $param->getValue());
}
} | [
"public",
"function",
"prepare",
"(",
"Location",
"$",
"location",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"formatter",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"No formatter specified (use type or classname attribute)\"",
",",
"$",
"location",
")",... | Configures wrapped formatter class with any attributes on this element.
@throws BuildException | [
"Configures",
"wrapped",
"formatter",
"class",
"with",
"any",
"attributes",
"on",
"this",
"element",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/pdo/PDOSQLExecFormatterElement.php#L169-L204 | train |
phingofficial/phing | classes/phing/types/PatternSetNameEntry.php | PatternSetNameEntry.valid | public function valid(Project $project)
{
if ($this->ifCond !== null && $project->getProperty($this->ifCond) === null) {
return false;
} else {
if ($this->unlessCond !== null && $project->getProperty($this->unlessCond) !== null) {
return false;
}
}
return true;
} | php | public function valid(Project $project)
{
if ($this->ifCond !== null && $project->getProperty($this->ifCond) === null) {
return false;
} else {
if ($this->unlessCond !== null && $project->getProperty($this->unlessCond) !== null) {
return false;
}
}
return true;
} | [
"public",
"function",
"valid",
"(",
"Project",
"$",
"project",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ifCond",
"!==",
"null",
"&&",
"$",
"project",
"->",
"getProperty",
"(",
"$",
"this",
"->",
"ifCond",
")",
"===",
"null",
")",
"{",
"return",
"fals... | Checks whether pattern should be applied based on whether the if and unless
properties are set in project.
@param Project $project
@return boolean | [
"Checks",
"whether",
"pattern",
"should",
"be",
"applied",
"based",
"on",
"whether",
"the",
"if",
"and",
"unless",
"properties",
"are",
"set",
"in",
"project",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/types/PatternSetNameEntry.php#L101-L112 | train |
phingofficial/phing | classes/phing/filters/ReplaceTokensWithFile.php | ReplaceTokensWithFile.replaceTokenCallback | private function replaceTokenCallback($matches)
{
$filetoken = $matches[1];
// We look in all specified directories for the named file and use
// the first directory which has the file.
$dirs = explode(';', $this->_dir);
$ndirs = count($dirs);
$n = 0;
$file = $dirs[$n] . $this->_prefix . $filetoken . $this->_postfix;
while ($n < $ndirs && !is_readable($file)) {
++$n;
}
if (!is_readable($file) || $n >= $ndirs) {
$this->log(
"Can not read or find file \"$file\". Searched in directories: {$this->_dir}",
Project::MSG_WARN
);
//return $this->_beginToken . $filetoken . $this->_endToken;
return "[Phing::Filters::ReplaceTokensWithFile: Can not find file " . '"' . $filetoken . $this->_postfix . '"' . "]";
}
$buffer = file_get_contents($file);
if ($this->_translatehtml) {
$buffer = htmlentities($buffer);
}
if ($buffer === null) {
$buffer = $this->_beginToken . $filetoken . $this->_endToken;
$this->log("No corresponding file found for key \"$buffer\"", Project::MSG_WARN);
} else {
$this->log(
"Replaced \"" . $this->_beginToken . $filetoken . $this->_endToken . "\" with content from file \"$file\""
);
}
return $buffer;
} | php | private function replaceTokenCallback($matches)
{
$filetoken = $matches[1];
// We look in all specified directories for the named file and use
// the first directory which has the file.
$dirs = explode(';', $this->_dir);
$ndirs = count($dirs);
$n = 0;
$file = $dirs[$n] . $this->_prefix . $filetoken . $this->_postfix;
while ($n < $ndirs && !is_readable($file)) {
++$n;
}
if (!is_readable($file) || $n >= $ndirs) {
$this->log(
"Can not read or find file \"$file\". Searched in directories: {$this->_dir}",
Project::MSG_WARN
);
//return $this->_beginToken . $filetoken . $this->_endToken;
return "[Phing::Filters::ReplaceTokensWithFile: Can not find file " . '"' . $filetoken . $this->_postfix . '"' . "]";
}
$buffer = file_get_contents($file);
if ($this->_translatehtml) {
$buffer = htmlentities($buffer);
}
if ($buffer === null) {
$buffer = $this->_beginToken . $filetoken . $this->_endToken;
$this->log("No corresponding file found for key \"$buffer\"", Project::MSG_WARN);
} else {
$this->log(
"Replaced \"" . $this->_beginToken . $filetoken . $this->_endToken . "\" with content from file \"$file\""
);
}
return $buffer;
} | [
"private",
"function",
"replaceTokenCallback",
"(",
"$",
"matches",
")",
"{",
"$",
"filetoken",
"=",
"$",
"matches",
"[",
"1",
"]",
";",
"// We look in all specified directories for the named file and use",
"// the first directory which has the file.",
"$",
"dirs",
"=",
"... | Replace the token found with the appropriate file contents
@param array $matches Array of 1 el containing key to search for.
@return string Text with which to replace key or value of key if none is found. | [
"Replace",
"the",
"token",
"found",
"with",
"the",
"appropriate",
"file",
"contents"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/ReplaceTokensWithFile.php#L250-L290 | train |
phingofficial/phing | classes/phing/filters/ReplaceTokensWithFile.php | ReplaceTokensWithFile.read | public function read($len = null)
{
if (!$this->getInitialized()) {
$this->_initialize();
$this->setInitialized(true);
}
// read from next filter up the chain
$buffer = $this->in->read($len);
if ($buffer === -1) {
return -1;
}
// filter buffer
$buffer = preg_replace_callback(
"$" . preg_quote($this->_beginToken) . "([\w\.\-:\/]+?)" . preg_quote($this->_endToken) . "$",
[$this, 'replaceTokenCallback'],
$buffer
);
return $buffer;
} | php | public function read($len = null)
{
if (!$this->getInitialized()) {
$this->_initialize();
$this->setInitialized(true);
}
// read from next filter up the chain
$buffer = $this->in->read($len);
if ($buffer === -1) {
return -1;
}
// filter buffer
$buffer = preg_replace_callback(
"$" . preg_quote($this->_beginToken) . "([\w\.\-:\/]+?)" . preg_quote($this->_endToken) . "$",
[$this, 'replaceTokenCallback'],
$buffer
);
return $buffer;
} | [
"public",
"function",
"read",
"(",
"$",
"len",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getInitialized",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_initialize",
"(",
")",
";",
"$",
"this",
"->",
"setInitialized",
"(",
"true",
")",
... | Returns stream with tokens having been replaced with appropriate values.
If a replacement value is not found for a token, the token is left in the stream.
@param null $len
@return mixed filtered stream, -1 on EOF. | [
"Returns",
"stream",
"with",
"tokens",
"having",
"been",
"replaced",
"with",
"appropriate",
"values",
".",
"If",
"a",
"replacement",
"value",
"is",
"not",
"found",
"for",
"a",
"token",
"the",
"token",
"is",
"left",
"in",
"the",
"stream",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/ReplaceTokensWithFile.php#L299-L321 | train |
phingofficial/phing | classes/phing/filters/ReplaceTokensWithFile.php | ReplaceTokensWithFile.chain | public function chain(Reader $reader)
{
$newFilter = new ReplaceTokensWithFile($reader);
$newFilter->setProject($this->getProject());
$newFilter->setTranslateHTML($this->getTranslateHTML());
$newFilter->setDir($this->getDir());
$newFilter->setPrefix($this->getPrefix());
$newFilter->setPostfix($this->getPostfix());
$newFilter->setBeginToken($this->getBeginToken());
$newFilter->setEndToken($this->getEndToken());
$newFilter->setInitialized(true);
return $newFilter;
} | php | public function chain(Reader $reader)
{
$newFilter = new ReplaceTokensWithFile($reader);
$newFilter->setProject($this->getProject());
$newFilter->setTranslateHTML($this->getTranslateHTML());
$newFilter->setDir($this->getDir());
$newFilter->setPrefix($this->getPrefix());
$newFilter->setPostfix($this->getPostfix());
$newFilter->setBeginToken($this->getBeginToken());
$newFilter->setEndToken($this->getEndToken());
$newFilter->setInitialized(true);
return $newFilter;
} | [
"public",
"function",
"chain",
"(",
"Reader",
"$",
"reader",
")",
"{",
"$",
"newFilter",
"=",
"new",
"ReplaceTokensWithFile",
"(",
"$",
"reader",
")",
";",
"$",
"newFilter",
"->",
"setProject",
"(",
"$",
"this",
"->",
"getProject",
"(",
")",
")",
";",
... | Creates a new ReplaceTokensWithFile using the passed in
Reader for instantiation.
@param Reader $reader
@internal param A $object Reader object providing the underlying stream.
Must not be <code>null</code>.
@return object A new filter based on this configuration, but filtering
the specified reader | [
"Creates",
"a",
"new",
"ReplaceTokensWithFile",
"using",
"the",
"passed",
"in",
"Reader",
"for",
"instantiation",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/filters/ReplaceTokensWithFile.php#L334-L347 | train |
phingofficial/phing | classes/phing/IntrospectionHelper.php | IntrospectionHelper.setAttribute | public function setAttribute(Project $project, $element, $attributeName, &$value)
{
// we want to check whether the value we are setting looks like
// a slot-listener variable: %{task.current_file}
//
// slot-listener variables are not like properties, in that they cannot be mixed with
// other text values. The reason for this disparity is that properties are only
// set when first constructing objects from XML, whereas slot-listeners are always dynamic.
//
// This is made possible by PHP5 (objects automatically passed by reference) and PHP's loose
// typing.
if (StringHelper::isSlotVar($value)) {
$as = "setlistening" . strtolower($attributeName);
if (!isset($this->slotListeners[$as])) {
$msg = $this->getElementName(
$project,
$element
) . " doesn't support a slot-listening '$attributeName' attribute.";
throw new BuildException($msg);
}
$method = $this->slotListeners[$as];
$key = StringHelper::slotVar($value);
$value = Register::getSlot(
$key
); // returns a RegisterSlot object which will hold current value of that register (accessible using getValue())
} else {
// Traditional value options
$as = "set" . strtolower($attributeName);
if (!isset($this->attributeSetters[$as])) {
$msg = $this->getElementName($project, $element) . " doesn't support the '$attributeName' attribute.";
throw new BuildException($msg);
}
$method = $this->attributeSetters[$as];
if ($as == "setrefid") {
$value = new Reference($project, $value);
} else {
// value is a string representation of a boolean type,
// convert it to primitive
if (StringHelper::isBoolean($value)) {
$value = StringHelper::booleanValue($value);
}
// does method expect a PhingFile object? if so, then
// pass a project-relative file.
$params = $method->getParameters();
$classname = null;
if (($hint = $params[0]->getClass()) !== null) {
$classname = $hint->getName();
}
// there should only be one param; we'll just assume ....
if ($classname !== null) {
switch (strtolower($classname)) {
case "phingfile":
$value = $project->resolveFile($value);
break;
case "path":
$value = new Path($project, $value);
break;
case "reference":
$value = new Reference($project, $value);
break;
// any other object params we want to support should go here ...
}
} // if hint !== null
} // if not setrefid
} // if is slot-listener
try {
$project->log(
" -calling setter " . $method->getDeclaringClass()->getName() . "::" . $method->getName() . "()",
Project::MSG_DEBUG
);
$method->invoke($element, $value);
} catch (Exception $exc) {
throw new BuildException($exc->getMessage(), $exc);
}
} | php | public function setAttribute(Project $project, $element, $attributeName, &$value)
{
// we want to check whether the value we are setting looks like
// a slot-listener variable: %{task.current_file}
//
// slot-listener variables are not like properties, in that they cannot be mixed with
// other text values. The reason for this disparity is that properties are only
// set when first constructing objects from XML, whereas slot-listeners are always dynamic.
//
// This is made possible by PHP5 (objects automatically passed by reference) and PHP's loose
// typing.
if (StringHelper::isSlotVar($value)) {
$as = "setlistening" . strtolower($attributeName);
if (!isset($this->slotListeners[$as])) {
$msg = $this->getElementName(
$project,
$element
) . " doesn't support a slot-listening '$attributeName' attribute.";
throw new BuildException($msg);
}
$method = $this->slotListeners[$as];
$key = StringHelper::slotVar($value);
$value = Register::getSlot(
$key
); // returns a RegisterSlot object which will hold current value of that register (accessible using getValue())
} else {
// Traditional value options
$as = "set" . strtolower($attributeName);
if (!isset($this->attributeSetters[$as])) {
$msg = $this->getElementName($project, $element) . " doesn't support the '$attributeName' attribute.";
throw new BuildException($msg);
}
$method = $this->attributeSetters[$as];
if ($as == "setrefid") {
$value = new Reference($project, $value);
} else {
// value is a string representation of a boolean type,
// convert it to primitive
if (StringHelper::isBoolean($value)) {
$value = StringHelper::booleanValue($value);
}
// does method expect a PhingFile object? if so, then
// pass a project-relative file.
$params = $method->getParameters();
$classname = null;
if (($hint = $params[0]->getClass()) !== null) {
$classname = $hint->getName();
}
// there should only be one param; we'll just assume ....
if ($classname !== null) {
switch (strtolower($classname)) {
case "phingfile":
$value = $project->resolveFile($value);
break;
case "path":
$value = new Path($project, $value);
break;
case "reference":
$value = new Reference($project, $value);
break;
// any other object params we want to support should go here ...
}
} // if hint !== null
} // if not setrefid
} // if is slot-listener
try {
$project->log(
" -calling setter " . $method->getDeclaringClass()->getName() . "::" . $method->getName() . "()",
Project::MSG_DEBUG
);
$method->invoke($element, $value);
} catch (Exception $exc) {
throw new BuildException($exc->getMessage(), $exc);
}
} | [
"public",
"function",
"setAttribute",
"(",
"Project",
"$",
"project",
",",
"$",
"element",
",",
"$",
"attributeName",
",",
"&",
"$",
"value",
")",
"{",
"// we want to check whether the value we are setting looks like",
"// a slot-listener variable: %{task.current_file}",
"... | Sets the named attribute.
@param Project $project
@param object $element
@param string $attributeName
@param mixed $value
@throws BuildException | [
"Sets",
"the",
"named",
"attribute",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/IntrospectionHelper.php#L277-L365 | train |
phingofficial/phing | classes/phing/IntrospectionHelper.php | IntrospectionHelper.addText | public function addText(Project $project, $element, $text)
{
if ($this->methodAddText === null) {
$msg = $this->getElementName($project, $element) . " doesn't support nested text data.";
throw new BuildException($msg);
}
try {
$method = $this->methodAddText;
$method->invoke($element, $text);
} catch (Exception $exc) {
throw new BuildException($exc->getMessage(), $exc);
}
} | php | public function addText(Project $project, $element, $text)
{
if ($this->methodAddText === null) {
$msg = $this->getElementName($project, $element) . " doesn't support nested text data.";
throw new BuildException($msg);
}
try {
$method = $this->methodAddText;
$method->invoke($element, $text);
} catch (Exception $exc) {
throw new BuildException($exc->getMessage(), $exc);
}
} | [
"public",
"function",
"addText",
"(",
"Project",
"$",
"project",
",",
"$",
"element",
",",
"$",
"text",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"methodAddText",
"===",
"null",
")",
"{",
"$",
"msg",
"=",
"$",
"this",
"->",
"getElementName",
"(",
"$",
... | Adds PCDATA areas.
@param Project $project
@param string $element
@param string $text
@throws BuildException | [
"Adds",
"PCDATA",
"areas",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/IntrospectionHelper.php#L375-L387 | train |
phingofficial/phing | classes/phing/IntrospectionHelper.php | IntrospectionHelper.getAttributes | public function getAttributes()
{
$attribs = [];
foreach (array_keys($this->attributeSetters) as $setter) {
$attribs[] = $this->getPropertyName($setter, "set");
}
return $attribs;
} | php | public function getAttributes()
{
$attribs = [];
foreach (array_keys($this->attributeSetters) as $setter) {
$attribs[] = $this->getPropertyName($setter, "set");
}
return $attribs;
} | [
"public",
"function",
"getAttributes",
"(",
")",
"{",
"$",
"attribs",
"=",
"[",
"]",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"attributeSetters",
")",
"as",
"$",
"setter",
")",
"{",
"$",
"attribs",
"[",
"]",
"=",
"$",
"this",
"->",
... | Return all attribues supported by the introspected class.
@return string[] | [
"Return",
"all",
"attribues",
"supported",
"by",
"the",
"introspected",
"class",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/IntrospectionHelper.php#L547-L555 | train |
phingofficial/phing | classes/phing/IntrospectionHelper.php | IntrospectionHelper.getPropertyName | public function getPropertyName($methodName, $prefix)
{
$start = strlen($prefix);
return strtolower(substr($methodName, $start));
} | php | public function getPropertyName($methodName, $prefix)
{
$start = strlen($prefix);
return strtolower(substr($methodName, $start));
} | [
"public",
"function",
"getPropertyName",
"(",
"$",
"methodName",
",",
"$",
"prefix",
")",
"{",
"$",
"start",
"=",
"strlen",
"(",
"$",
"prefix",
")",
";",
"return",
"strtolower",
"(",
"substr",
"(",
"$",
"methodName",
",",
"$",
"start",
")",
")",
";",
... | Extract the name of a property from a method name - subtracting a given prefix.
@param string $methodName
@param string $prefix
@return string | [
"Extract",
"the",
"name",
"of",
"a",
"property",
"from",
"a",
"method",
"name",
"-",
"subtracting",
"a",
"given",
"prefix",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/IntrospectionHelper.php#L616-L621 | train |
phingofficial/phing | classes/phing/tasks/ext/ZendCodeAnalyzerTask.php | ZendCodeAnalyzerTask.main | public function main()
{
if (!isset($this->analyzerPath)) {
throw new BuildException("Missing attribute 'analyzerPath'");
}
if (!isset($this->file) and count($this->filesets) == 0) {
throw new BuildException("Missing either a nested fileset or attribute 'file' set");
}
if ($this->file instanceof PhingFile) {
$this->analyze($this->file->getPath());
} else { // process filesets
$project = $this->getProject();
foreach ($this->filesets as $fs) {
$ds = $fs->getDirectoryScanner($project);
$files = $ds->getIncludedFiles();
$dir = $fs->getDir($this->project)->getPath();
foreach ($files as $file) {
$this->analyze($dir . DIRECTORY_SEPARATOR . $file);
}
}
}
$this->log("Number of findings: " . $this->counter, Project::MSG_INFO);
} | php | public function main()
{
if (!isset($this->analyzerPath)) {
throw new BuildException("Missing attribute 'analyzerPath'");
}
if (!isset($this->file) and count($this->filesets) == 0) {
throw new BuildException("Missing either a nested fileset or attribute 'file' set");
}
if ($this->file instanceof PhingFile) {
$this->analyze($this->file->getPath());
} else { // process filesets
$project = $this->getProject();
foreach ($this->filesets as $fs) {
$ds = $fs->getDirectoryScanner($project);
$files = $ds->getIncludedFiles();
$dir = $fs->getDir($this->project)->getPath();
foreach ($files as $file) {
$this->analyze($dir . DIRECTORY_SEPARATOR . $file);
}
}
}
$this->log("Number of findings: " . $this->counter, Project::MSG_INFO);
} | [
"public",
"function",
"main",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"analyzerPath",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"Missing attribute 'analyzerPath'\"",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
... | Analyze against PhingFile or a FileSet | [
"Analyze",
"against",
"PhingFile",
"or",
"a",
"FileSet"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/ZendCodeAnalyzerTask.php#L126-L153 | train |
phingofficial/phing | classes/phing/tasks/ext/visualizer/VisualizerTask.php | VisualizerTask.init | public function init(): void
{
$this->setFormat(VisualizerTask::FORMAT_PNG);
$this->setServer(VisualizerTask::SERVER);
$this->checkHttpRequestLibrary();
$this->checkPlantUmlLibrary();
$this->checkXslExtension();
$this->checkXmlExtension();
} | php | public function init(): void
{
$this->setFormat(VisualizerTask::FORMAT_PNG);
$this->setServer(VisualizerTask::SERVER);
$this->checkHttpRequestLibrary();
$this->checkPlantUmlLibrary();
$this->checkXslExtension();
$this->checkXmlExtension();
} | [
"public",
"function",
"init",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"setFormat",
"(",
"VisualizerTask",
"::",
"FORMAT_PNG",
")",
";",
"$",
"this",
"->",
"setServer",
"(",
"VisualizerTask",
"::",
"SERVER",
")",
";",
"$",
"this",
"->",
"checkHttpR... | Setting some default values and checking requirements | [
"Setting",
"some",
"default",
"values",
"and",
"checking",
"requirements"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/visualizer/VisualizerTask.php#L43-L51 | train |
phingofficial/phing | classes/phing/tasks/ext/visualizer/VisualizerTask.php | VisualizerTask.checkPlantUmlLibrary | protected function checkPlantUmlLibrary()
{
$function = '\Jawira\PlantUml\encodep';
$message = "Please install 'jawira/plantuml-encoding' library";
if (!function_exists($function)) {
$this->log($message, Project::MSG_ERR);
throw new BuildException($message);
}
} | php | protected function checkPlantUmlLibrary()
{
$function = '\Jawira\PlantUml\encodep';
$message = "Please install 'jawira/plantuml-encoding' library";
if (!function_exists($function)) {
$this->log($message, Project::MSG_ERR);
throw new BuildException($message);
}
} | [
"protected",
"function",
"checkPlantUmlLibrary",
"(",
")",
"{",
"$",
"function",
"=",
"'\\Jawira\\PlantUml\\encodep'",
";",
"$",
"message",
"=",
"\"Please install 'jawira/plantuml-encoding' library\"",
";",
"if",
"(",
"!",
"function_exists",
"(",
"$",
"function",
")",
... | Checks that `encodep` function is available
Instead of checking that `jawira/plantuml-encoding` library is loaded we only check 'encodep' function
availability | [
"Checks",
"that",
"encodep",
"function",
"is",
"available"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/visualizer/VisualizerTask.php#L83-L92 | train |
phingofficial/phing | classes/phing/tasks/ext/visualizer/VisualizerTask.php | VisualizerTask.generatePumlDiagram | protected function generatePumlDiagram(): string
{
/**
* @var \PhingXMLContext $xmlContext
*/
$xmlContext = $this->getProject()
->getReference("phing.parsing.context");
$importStack = $xmlContext->getImportStack();
$pumlDiagram = $this->generatePuml($importStack);
return $pumlDiagram;
} | php | protected function generatePumlDiagram(): string
{
/**
* @var \PhingXMLContext $xmlContext
*/
$xmlContext = $this->getProject()
->getReference("phing.parsing.context");
$importStack = $xmlContext->getImportStack();
$pumlDiagram = $this->generatePuml($importStack);
return $pumlDiagram;
} | [
"protected",
"function",
"generatePumlDiagram",
"(",
")",
":",
"string",
"{",
"/**\n * @var \\PhingXMLContext $xmlContext\n */",
"$",
"xmlContext",
"=",
"$",
"this",
"->",
"getProject",
"(",
")",
"->",
"getReference",
"(",
"\"phing.parsing.context\"",
")",... | Retrieves loaded buildfiles and generates a PlantUML diagram
@return string | [
"Retrieves",
"loaded",
"buildfiles",
"and",
"generates",
"a",
"PlantUML",
"diagram"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/visualizer/VisualizerTask.php#L135-L146 | train |
phingofficial/phing | classes/phing/tasks/ext/visualizer/VisualizerTask.php | VisualizerTask.generatePuml | protected function generatePuml(array $buildFiles): string
{
$puml = $this->transformToPuml(reset($buildFiles), VisualizerTask::XSL_HEADER);
/**
* @var \PhingFile $buildFile
*/
foreach ($buildFiles as $buildFile) {
$puml .= $this->transformToPuml($buildFile, VisualizerTask::XSL_TARGETS);
}
foreach ($buildFiles as $buildFile) {
$puml .= $this->transformToPuml($buildFile, VisualizerTask::XSL_CALLS);
}
$puml .= $this->transformToPuml(reset($buildFiles), VisualizerTask::XSL_FOOTER);
return $puml;
} | php | protected function generatePuml(array $buildFiles): string
{
$puml = $this->transformToPuml(reset($buildFiles), VisualizerTask::XSL_HEADER);
/**
* @var \PhingFile $buildFile
*/
foreach ($buildFiles as $buildFile) {
$puml .= $this->transformToPuml($buildFile, VisualizerTask::XSL_TARGETS);
}
foreach ($buildFiles as $buildFile) {
$puml .= $this->transformToPuml($buildFile, VisualizerTask::XSL_CALLS);
}
$puml .= $this->transformToPuml(reset($buildFiles), VisualizerTask::XSL_FOOTER);
return $puml;
} | [
"protected",
"function",
"generatePuml",
"(",
"array",
"$",
"buildFiles",
")",
":",
"string",
"{",
"$",
"puml",
"=",
"$",
"this",
"->",
"transformToPuml",
"(",
"reset",
"(",
"$",
"buildFiles",
")",
",",
"VisualizerTask",
"::",
"XSL_HEADER",
")",
";",
"/**\... | Read through provided buildfiles and generates a PlantUML diagram
@param \PhingFile[] $buildFiles
@return string | [
"Read",
"through",
"provided",
"buildfiles",
"and",
"generates",
"a",
"PlantUML",
"diagram"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/visualizer/VisualizerTask.php#L155-L173 | train |
phingofficial/phing | classes/phing/tasks/ext/visualizer/VisualizerTask.php | VisualizerTask.loadXmlFile | protected function loadXmlFile(string $xmlFile): SimpleXMLElement
{
$xmlContent = (new FileReader($xmlFile))->read();
$xml = simplexml_load_string($xmlContent);
if (!($xml instanceof SimpleXMLElement)) {
$message = "Error loading XML file: $xmlFile";
$this->log($message, Project::MSG_ERR);
throw new BuildException($message);
}
return $xml;
} | php | protected function loadXmlFile(string $xmlFile): SimpleXMLElement
{
$xmlContent = (new FileReader($xmlFile))->read();
$xml = simplexml_load_string($xmlContent);
if (!($xml instanceof SimpleXMLElement)) {
$message = "Error loading XML file: $xmlFile";
$this->log($message, Project::MSG_ERR);
throw new BuildException($message);
}
return $xml;
} | [
"protected",
"function",
"loadXmlFile",
"(",
"string",
"$",
"xmlFile",
")",
":",
"SimpleXMLElement",
"{",
"$",
"xmlContent",
"=",
"(",
"new",
"FileReader",
"(",
"$",
"xmlFile",
")",
")",
"->",
"read",
"(",
")",
";",
"$",
"xml",
"=",
"simplexml_load_string"... | Load XML content from a file
@param string $xmlFile XML or XSLT file
@return \SimpleXMLElement | [
"Load",
"XML",
"content",
"from",
"a",
"file"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/visualizer/VisualizerTask.php#L201-L213 | train |
phingofficial/phing | classes/phing/tasks/ext/visualizer/VisualizerTask.php | VisualizerTask.resolveImageDestination | protected function resolveImageDestination(): PhingFile
{
$phingFile = $this->getProject()->getProperty('phing.file');
$format = $this->getFormat();
$candidate = $this->getDestination();
$path = $this->resolveDestination($phingFile, $format, $candidate);
return new PhingFile($path);
} | php | protected function resolveImageDestination(): PhingFile
{
$phingFile = $this->getProject()->getProperty('phing.file');
$format = $this->getFormat();
$candidate = $this->getDestination();
$path = $this->resolveDestination($phingFile, $format, $candidate);
return new PhingFile($path);
} | [
"protected",
"function",
"resolveImageDestination",
"(",
")",
":",
"PhingFile",
"{",
"$",
"phingFile",
"=",
"$",
"this",
"->",
"getProject",
"(",
")",
"->",
"getProperty",
"(",
"'phing.file'",
")",
";",
"$",
"format",
"=",
"$",
"this",
"->",
"getFormat",
"... | Get the image's final location
@return \PhingFile
@throws \IOException
@throws \NullPointerException | [
"Get",
"the",
"image",
"s",
"final",
"location"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/visualizer/VisualizerTask.php#L222-L230 | train |
phingofficial/phing | classes/phing/tasks/ext/visualizer/VisualizerTask.php | VisualizerTask.setFormat | public function setFormat(string $format): VisualizerTask
{
switch ($format) {
case VisualizerTask::FORMAT_PUML:
case VisualizerTask::FORMAT_PNG:
case VisualizerTask::FORMAT_EPS:
case VisualizerTask::FORMAT_SVG:
$this->format = $format;
break;
default:
$message = "'$format' is not a valid format";
$this->log($message, Project::MSG_ERR);
throw new BuildException($message);
break;
}
return $this;
} | php | public function setFormat(string $format): VisualizerTask
{
switch ($format) {
case VisualizerTask::FORMAT_PUML:
case VisualizerTask::FORMAT_PNG:
case VisualizerTask::FORMAT_EPS:
case VisualizerTask::FORMAT_SVG:
$this->format = $format;
break;
default:
$message = "'$format' is not a valid format";
$this->log($message, Project::MSG_ERR);
throw new BuildException($message);
break;
}
return $this;
} | [
"public",
"function",
"setFormat",
"(",
"string",
"$",
"format",
")",
":",
"VisualizerTask",
"{",
"switch",
"(",
"$",
"format",
")",
"{",
"case",
"VisualizerTask",
"::",
"FORMAT_PUML",
":",
"case",
"VisualizerTask",
"::",
"FORMAT_PNG",
":",
"case",
"Visualizer... | Sets and validates diagram's format
@param string $format
@return VisualizerTask | [
"Sets",
"and",
"validates",
"diagram",
"s",
"format"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/visualizer/VisualizerTask.php#L247-L264 | train |
phingofficial/phing | classes/phing/tasks/ext/visualizer/VisualizerTask.php | VisualizerTask.resolveDestination | protected function resolveDestination(string $buildfilePath, string $format, ?string $destination): string
{
$buildfileInfo = pathinfo($buildfilePath);
// Fallback
if (empty($destination)) {
$destination = $buildfileInfo['dirname'];
}
// Adding filename if necessary
if (is_dir($destination)) {
$destination .= DIRECTORY_SEPARATOR . $buildfileInfo['filename'] . '.' . $format;
}
// Check if path is available
if (!is_dir(dirname($destination))) {
$message = "Directory '$destination' is invalid";
$this->log($message, Project::MSG_ERR);
throw new BuildException(sprintf($message, $destination));
}
return $destination;
} | php | protected function resolveDestination(string $buildfilePath, string $format, ?string $destination): string
{
$buildfileInfo = pathinfo($buildfilePath);
// Fallback
if (empty($destination)) {
$destination = $buildfileInfo['dirname'];
}
// Adding filename if necessary
if (is_dir($destination)) {
$destination .= DIRECTORY_SEPARATOR . $buildfileInfo['filename'] . '.' . $format;
}
// Check if path is available
if (!is_dir(dirname($destination))) {
$message = "Directory '$destination' is invalid";
$this->log($message, Project::MSG_ERR);
throw new BuildException(sprintf($message, $destination));
}
return $destination;
} | [
"protected",
"function",
"resolveDestination",
"(",
"string",
"$",
"buildfilePath",
",",
"string",
"$",
"format",
",",
"?",
"string",
"$",
"destination",
")",
":",
"string",
"{",
"$",
"buildfileInfo",
"=",
"pathinfo",
"(",
"$",
"buildfilePath",
")",
";",
"//... | Figure diagram's file path
@param string $buildfilePath Path to main buildfile
@param string $format Extension to use
@param null|string $destination Desired destination provided by user
@return string | [
"Figure",
"diagram",
"s",
"file",
"path"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/visualizer/VisualizerTask.php#L295-L317 | train |
phingofficial/phing | classes/phing/tasks/ext/visualizer/VisualizerTask.php | VisualizerTask.generateImage | protected function generateImage(string $pumlDiagram, string $format): string
{
if ($format === VisualizerTask::FORMAT_PUML) {
$this->log('Bypassing, no need to call server', Project::MSG_DEBUG);
return $pumlDiagram;
}
$format = $this->getFormat();
$encodedPuml = encodep($pumlDiagram);
$this->prepareImageUrl($format, $encodedPuml);
$response = $this->createRequest()->send();
$this->processResponse($response); // used for status validation
return $response->getBody();
} | php | protected function generateImage(string $pumlDiagram, string $format): string
{
if ($format === VisualizerTask::FORMAT_PUML) {
$this->log('Bypassing, no need to call server', Project::MSG_DEBUG);
return $pumlDiagram;
}
$format = $this->getFormat();
$encodedPuml = encodep($pumlDiagram);
$this->prepareImageUrl($format, $encodedPuml);
$response = $this->createRequest()->send();
$this->processResponse($response); // used for status validation
return $response->getBody();
} | [
"protected",
"function",
"generateImage",
"(",
"string",
"$",
"pumlDiagram",
",",
"string",
"$",
"format",
")",
":",
"string",
"{",
"if",
"(",
"$",
"format",
"===",
"VisualizerTask",
"::",
"FORMAT_PUML",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'Bypassing... | Generates an actual image using PlantUML code
@param string $pumlDiagram
@param string $format
@return string
@throws \HTTP_Request2_Exception | [
"Generates",
"an",
"actual",
"image",
"using",
"PlantUML",
"code"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/visualizer/VisualizerTask.php#L328-L344 | train |
phingofficial/phing | classes/phing/tasks/ext/visualizer/VisualizerTask.php | VisualizerTask.prepareImageUrl | protected function prepareImageUrl(string $format, string $encodedPuml): void
{
$server = $this->getServer();
$this->log("Server: $server", Project::MSG_VERBOSE);
$server = filter_var($server, FILTER_VALIDATE_URL);
if ($server === false) {
$message = 'Invalid PlantUml server';
$this->log($message, Project::MSG_ERR);
throw new BuildException($message);
}
$imageUrl = sprintf('%s/%s/%s', rtrim($server, '/'), $format, $encodedPuml);
$this->log($imageUrl, Project::MSG_DEBUG);
$this->setUrl($imageUrl);
} | php | protected function prepareImageUrl(string $format, string $encodedPuml): void
{
$server = $this->getServer();
$this->log("Server: $server", Project::MSG_VERBOSE);
$server = filter_var($server, FILTER_VALIDATE_URL);
if ($server === false) {
$message = 'Invalid PlantUml server';
$this->log($message, Project::MSG_ERR);
throw new BuildException($message);
}
$imageUrl = sprintf('%s/%s/%s', rtrim($server, '/'), $format, $encodedPuml);
$this->log($imageUrl, Project::MSG_DEBUG);
$this->setUrl($imageUrl);
} | [
"protected",
"function",
"prepareImageUrl",
"(",
"string",
"$",
"format",
",",
"string",
"$",
"encodedPuml",
")",
":",
"void",
"{",
"$",
"server",
"=",
"$",
"this",
"->",
"getServer",
"(",
")",
";",
"$",
"this",
"->",
"log",
"(",
"\"Server: $server\"",
"... | Prepares URL from where image will be downloaded
@param string $format
@param string $encodedPuml | [
"Prepares",
"URL",
"from",
"where",
"image",
"will",
"be",
"downloaded"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/visualizer/VisualizerTask.php#L352-L367 | train |
phingofficial/phing | classes/phing/tasks/ext/visualizer/VisualizerTask.php | VisualizerTask.processResponse | protected function processResponse(HTTP_Request2_Response $response): void
{
$status = $response->getStatus();
$reasonPhrase = $response->getReasonPhrase();
$this->log("Response status: $status", Project::MSG_DEBUG);
$this->log("Response reason: $reasonPhrase", Project::MSG_DEBUG);
if ($status !== VisualizerTask::STATUS_OK) {
$message = "Request unsuccessful. Response from server: $status $reasonPhrase";
$this->log($message, Project::MSG_ERR);
throw new BuildException($message);
}
} | php | protected function processResponse(HTTP_Request2_Response $response): void
{
$status = $response->getStatus();
$reasonPhrase = $response->getReasonPhrase();
$this->log("Response status: $status", Project::MSG_DEBUG);
$this->log("Response reason: $reasonPhrase", Project::MSG_DEBUG);
if ($status !== VisualizerTask::STATUS_OK) {
$message = "Request unsuccessful. Response from server: $status $reasonPhrase";
$this->log($message, Project::MSG_ERR);
throw new BuildException($message);
}
} | [
"protected",
"function",
"processResponse",
"(",
"HTTP_Request2_Response",
"$",
"response",
")",
":",
"void",
"{",
"$",
"status",
"=",
"$",
"response",
"->",
"getStatus",
"(",
")",
";",
"$",
"reasonPhrase",
"=",
"$",
"response",
"->",
"getReasonPhrase",
"(",
... | Receive server's response
This method validates `$response`'s status
@param HTTP_Request2_Response $response Response from server
@return void | [
"Receive",
"server",
"s",
"response"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/visualizer/VisualizerTask.php#L398-L410 | train |
phingofficial/phing | classes/phing/tasks/system/condition/IsFileSelected.php | IsFileSelected.evaluate | public function evaluate()
{
if ($this->file === null) {
throw new BuildException('file attribute not set');
}
$this->validate();
$myBaseDir = $this->baseDir;
if ($myBaseDir === null) {
$myBaseDir = $this->getProject()->getBaseDir();
}
/**
* @var FileSelector $f
*/
$file = $this->getSelectors($this->getProject());
$f = $file[0];
return $f->isSelected($myBaseDir, $this->file->getName(), $this->file);
} | php | public function evaluate()
{
if ($this->file === null) {
throw new BuildException('file attribute not set');
}
$this->validate();
$myBaseDir = $this->baseDir;
if ($myBaseDir === null) {
$myBaseDir = $this->getProject()->getBaseDir();
}
/**
* @var FileSelector $f
*/
$file = $this->getSelectors($this->getProject());
$f = $file[0];
return $f->isSelected($myBaseDir, $this->file->getName(), $this->file);
} | [
"public",
"function",
"evaluate",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"file",
"===",
"null",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'file attribute not set'",
")",
";",
"}",
"$",
"this",
"->",
"validate",
"(",
")",
";",
"$",
"myBase... | Evaluate the selector with the file.
@return true if the file is selected by the embedded selector. | [
"Evaluate",
"the",
"selector",
"with",
"the",
"file",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/condition/IsFileSelected.php#L68-L85 | train |
phingofficial/phing | classes/phing/Diagnostics.php | Diagnostics.doReport | public static function doReport(PrintStream $out)
{
$out->println(str_pad('Phing diagnostics report', 79, "-", STR_PAD_BOTH));
self::header($out, "Version");
$out->println(Phing::getPhingVersion());
self::header($out, "Project properties");
self::doReportProjectProperties($out);
self::header($out, "System properties");
self::doReportSystemProperties($out);
self::header($out, "PHING_HOME/vendor package listing");
self::doReportPhingVendorLibraries($out);
self::header($out, "COMPOSER_HOME/vendor package listing");
self::doReportComposerSystemLibraries($out);
self::header($out, "Tasks availability");
self::doReportTasksAvailability($out);
self::header($out, "Temp dir");
self::doReportTempDir($out);
} | php | public static function doReport(PrintStream $out)
{
$out->println(str_pad('Phing diagnostics report', 79, "-", STR_PAD_BOTH));
self::header($out, "Version");
$out->println(Phing::getPhingVersion());
self::header($out, "Project properties");
self::doReportProjectProperties($out);
self::header($out, "System properties");
self::doReportSystemProperties($out);
self::header($out, "PHING_HOME/vendor package listing");
self::doReportPhingVendorLibraries($out);
self::header($out, "COMPOSER_HOME/vendor package listing");
self::doReportComposerSystemLibraries($out);
self::header($out, "Tasks availability");
self::doReportTasksAvailability($out);
self::header($out, "Temp dir");
self::doReportTempDir($out);
} | [
"public",
"static",
"function",
"doReport",
"(",
"PrintStream",
"$",
"out",
")",
"{",
"$",
"out",
"->",
"println",
"(",
"str_pad",
"(",
"'Phing diagnostics report'",
",",
"79",
",",
"\"-\"",
",",
"STR_PAD_BOTH",
")",
")",
";",
"self",
"::",
"header",
"(",
... | Print a report to the given stream.
@param PrintStream $out the stream to print the report to. | [
"Print",
"a",
"report",
"to",
"the",
"given",
"stream",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Diagnostics.php#L63-L86 | train |
phingofficial/phing | classes/phing/Diagnostics.php | Diagnostics.doReportSystemProperties | private static function doReportSystemProperties(PrintStream $out)
{
$phing = new Phing();
$phingprops = $phing->getProperties();
foreach ($phingprops as $key => $value) {
$out->println($key . " : " . $value);
}
} | php | private static function doReportSystemProperties(PrintStream $out)
{
$phing = new Phing();
$phingprops = $phing->getProperties();
foreach ($phingprops as $key => $value) {
$out->println($key . " : " . $value);
}
} | [
"private",
"static",
"function",
"doReportSystemProperties",
"(",
"PrintStream",
"$",
"out",
")",
"{",
"$",
"phing",
"=",
"new",
"Phing",
"(",
")",
";",
"$",
"phingprops",
"=",
"$",
"phing",
"->",
"getProperties",
"(",
")",
";",
"foreach",
"(",
"$",
"phi... | Report a listing of system properties existing in the current phing.
@param PrintStream $out the stream to print the properties to. | [
"Report",
"a",
"listing",
"of",
"system",
"properties",
"existing",
"in",
"the",
"current",
"phing",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Diagnostics.php#L101-L110 | train |
phingofficial/phing | classes/phing/Diagnostics.php | Diagnostics.doReportProjectProperties | private static function doReportProjectProperties(PrintStream $out)
{
$project = new Project();
$project->init();
$sysprops = $project->getProperties();
foreach ($sysprops as $key => $value) {
$out->println($key . " : " . $value);
}
} | php | private static function doReportProjectProperties(PrintStream $out)
{
$project = new Project();
$project->init();
$sysprops = $project->getProperties();
foreach ($sysprops as $key => $value) {
$out->println($key . " : " . $value);
}
} | [
"private",
"static",
"function",
"doReportProjectProperties",
"(",
"PrintStream",
"$",
"out",
")",
"{",
"$",
"project",
"=",
"new",
"Project",
"(",
")",
";",
"$",
"project",
"->",
"init",
"(",
")",
";",
"$",
"sysprops",
"=",
"$",
"project",
"->",
"getPro... | Report a listing of project properties.
@param PrintStream $out the stream to print the properties to. | [
"Report",
"a",
"listing",
"of",
"project",
"properties",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Diagnostics.php#L117-L127 | train |
phingofficial/phing | classes/phing/Diagnostics.php | Diagnostics.doReportComposerSystemLibraries | private static function doReportComposerSystemLibraries(PrintStream $out)
{
$libs = self::listLibraries('platform');
self::printLibraries($libs, $out);
} | php | private static function doReportComposerSystemLibraries(PrintStream $out)
{
$libs = self::listLibraries('platform');
self::printLibraries($libs, $out);
} | [
"private",
"static",
"function",
"doReportComposerSystemLibraries",
"(",
"PrintStream",
"$",
"out",
")",
"{",
"$",
"libs",
"=",
"self",
"::",
"listLibraries",
"(",
"'platform'",
")",
";",
"self",
"::",
"printLibraries",
"(",
"$",
"libs",
",",
"$",
"out",
")"... | Report the content of the global composer library directory
@param PrintStream $out the stream to print the content to | [
"Report",
"the",
"content",
"of",
"the",
"global",
"composer",
"library",
"directory"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Diagnostics.php#L145-L149 | train |
phingofficial/phing | classes/phing/Diagnostics.php | Diagnostics.printLibraries | private static function printLibraries($libs, PrintStream $out)
{
if ($libs == null) {
$out->println("No such directory.");
return;
}
foreach ($libs as $lib) {
$out->println($lib);
}
} | php | private static function printLibraries($libs, PrintStream $out)
{
if ($libs == null) {
$out->println("No such directory.");
return;
}
foreach ($libs as $lib) {
$out->println($lib);
}
} | [
"private",
"static",
"function",
"printLibraries",
"(",
"$",
"libs",
",",
"PrintStream",
"$",
"out",
")",
"{",
"if",
"(",
"$",
"libs",
"==",
"null",
")",
"{",
"$",
"out",
"->",
"println",
"(",
"\"No such directory.\"",
")",
";",
"return",
";",
"}",
"fo... | list the libraries
@param array $libs array of libraries (can be null)
@param PrintStream $out output stream | [
"list",
"the",
"libraries"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Diagnostics.php#L157-L167 | train |
phingofficial/phing | classes/phing/Diagnostics.php | Diagnostics.doReportTasksAvailability | private static function doReportTasksAvailability(PrintStream $out)
{
$project = new Project();
$project->init();
$tasks = $project->getTaskDefinitions();
ksort($tasks);
foreach ($tasks as $shortName => $task) {
$out->println($shortName);
}
} | php | private static function doReportTasksAvailability(PrintStream $out)
{
$project = new Project();
$project->init();
$tasks = $project->getTaskDefinitions();
ksort($tasks);
foreach ($tasks as $shortName => $task) {
$out->println($shortName);
}
} | [
"private",
"static",
"function",
"doReportTasksAvailability",
"(",
"PrintStream",
"$",
"out",
")",
"{",
"$",
"project",
"=",
"new",
"Project",
"(",
")",
";",
"$",
"project",
"->",
"init",
"(",
")",
";",
"$",
"tasks",
"=",
"$",
"project",
"->",
"getTaskDe... | Create a report about all available task in phing.
@param PrintStream $out the stream to print the tasks report to
<tt>null</tt> for a missing stream (ie mapping). | [
"Create",
"a",
"report",
"about",
"all",
"available",
"task",
"in",
"phing",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Diagnostics.php#L175-L184 | train |
phingofficial/phing | classes/phing/Diagnostics.php | Diagnostics.doReportTempDir | private static function doReportTempDir(PrintStream $out)
{
$tempdir = PhingFile::getTempDir();
if ($tempdir == null) {
$out->println("Warning: php.tmpdir is undefined");
return;
}
$out->println("Temp dir is " . $tempdir);
$tempDirectory = new PhingFile($tempdir);
if (!$tempDirectory->exists()) {
$out->println("Warning, php.tmpdir directory does not exist: " . $tempdir);
return;
}
$now = time();
$tempFile = PhingFile::createTempFile('diag', 'txt', $tempDirectory);
$fileWriter = new FileWriter($tempFile);
$fileWriter->write('some test text');
$fileWriter->close();
$filetime = $tempFile->lastModified();
$tempFile->delete();
$out->println("Temp dir is writeable");
$drift = $filetime - $now;
$out->println("Temp dir alignment with system clock is " . $drift . " s");
if (abs($drift) > 10) {
$out->println("Warning: big clock drift -maybe a network filesystem");
}
} | php | private static function doReportTempDir(PrintStream $out)
{
$tempdir = PhingFile::getTempDir();
if ($tempdir == null) {
$out->println("Warning: php.tmpdir is undefined");
return;
}
$out->println("Temp dir is " . $tempdir);
$tempDirectory = new PhingFile($tempdir);
if (!$tempDirectory->exists()) {
$out->println("Warning, php.tmpdir directory does not exist: " . $tempdir);
return;
}
$now = time();
$tempFile = PhingFile::createTempFile('diag', 'txt', $tempDirectory);
$fileWriter = new FileWriter($tempFile);
$fileWriter->write('some test text');
$fileWriter->close();
$filetime = $tempFile->lastModified();
$tempFile->delete();
$out->println("Temp dir is writeable");
$drift = $filetime - $now;
$out->println("Temp dir alignment with system clock is " . $drift . " s");
if (abs($drift) > 10) {
$out->println("Warning: big clock drift -maybe a network filesystem");
}
} | [
"private",
"static",
"function",
"doReportTempDir",
"(",
"PrintStream",
"$",
"out",
")",
"{",
"$",
"tempdir",
"=",
"PhingFile",
"::",
"getTempDir",
"(",
")",
";",
"if",
"(",
"$",
"tempdir",
"==",
"null",
")",
"{",
"$",
"out",
"->",
"println",
"(",
"\"W... | try and create a temp file in our temp dir; this
checks that it has space and access.
We also do some clock reporting.
@param PrintStream $out | [
"try",
"and",
"create",
"a",
"temp",
"file",
"in",
"our",
"temp",
"dir",
";",
"this",
"checks",
"that",
"it",
"has",
"space",
"and",
"access",
".",
"We",
"also",
"do",
"some",
"clock",
"reporting",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/Diagnostics.php#L193-L224 | train |
phingofficial/phing | classes/phing/tasks/ext/phar/PharPackageTask.php | PharPackageTask.buildPhar | private function buildPhar()
{
$phar = new Phar($this->destinationFile);
if (!empty($this->stubPath)) {
$phar->setStub(file_get_contents($this->stubPath));
} else {
if (!empty($this->cliStubFile)) {
$cliStubFile = str_replace('\\', '/', $this->cliStubFile->getPathWithoutBase($this->baseDirectory));
} else {
$cliStubFile = null;
}
if (!empty($this->webStubFile)) {
$webStubFile = str_replace('\\', '/', $this->webStubFile->getPathWithoutBase($this->baseDirectory));
} else {
$webStubFile = null;
}
$phar->setDefaultStub($cliStubFile, $webStubFile);
}
if ($this->metadata === null) {
$this->createMetaData();
}
if ($metadata = $this->metadata->toArray()) {
$phar->setMetadata($metadata);
}
if (!empty($this->alias)) {
$phar->setAlias($this->alias);
}
return $phar;
} | php | private function buildPhar()
{
$phar = new Phar($this->destinationFile);
if (!empty($this->stubPath)) {
$phar->setStub(file_get_contents($this->stubPath));
} else {
if (!empty($this->cliStubFile)) {
$cliStubFile = str_replace('\\', '/', $this->cliStubFile->getPathWithoutBase($this->baseDirectory));
} else {
$cliStubFile = null;
}
if (!empty($this->webStubFile)) {
$webStubFile = str_replace('\\', '/', $this->webStubFile->getPathWithoutBase($this->baseDirectory));
} else {
$webStubFile = null;
}
$phar->setDefaultStub($cliStubFile, $webStubFile);
}
if ($this->metadata === null) {
$this->createMetaData();
}
if ($metadata = $this->metadata->toArray()) {
$phar->setMetadata($metadata);
}
if (!empty($this->alias)) {
$phar->setAlias($this->alias);
}
return $phar;
} | [
"private",
"function",
"buildPhar",
"(",
")",
"{",
"$",
"phar",
"=",
"new",
"Phar",
"(",
"$",
"this",
"->",
"destinationFile",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"stubPath",
")",
")",
"{",
"$",
"phar",
"->",
"setStub",
"(",
... | Build and configure Phar object.
@return Phar | [
"Build",
"and",
"configure",
"Phar",
"object",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/phar/PharPackageTask.php#L393-L428 | train |
phingofficial/phing | classes/phing/tasks/system/PhingTask.php | PhingTask.init | public function init()
{
$this->newProject = new Project();
$tdf = $this->project->getTaskDefinitions();
$this->newProject->addTaskDefinition("property", $tdf["property"]);
} | php | public function init()
{
$this->newProject = new Project();
$tdf = $this->project->getTaskDefinitions();
$this->newProject->addTaskDefinition("property", $tdf["property"]);
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"newProject",
"=",
"new",
"Project",
"(",
")",
";",
"$",
"tdf",
"=",
"$",
"this",
"->",
"project",
"->",
"getTaskDefinitions",
"(",
")",
";",
"$",
"this",
"->",
"newProject",
"->",
"addT... | Creates a Project instance for the project to call.
@return void | [
"Creates",
"a",
"Project",
"instance",
"for",
"the",
"project",
"to",
"call",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PhingTask.php#L105-L110 | train |
phingofficial/phing | classes/phing/tasks/system/PhingTask.php | PhingTask.reinit | private function reinit()
{
$this->init();
$count = count($this->properties);
for ($i = 0; $i < $count; $i++) {
/**
* @var PropertyTask $p
*/
$p = $this->properties[$i];
/**
* @var PropertyTask $newP
*/
$newP = $this->newProject->createTask("property");
$newP->setName($p->getName());
if ($p->getValue() !== null) {
$newP->setValue($p->getValue());
}
if ($p->getFile() !== null) {
$newP->setFile($p->getFile());
}
if ($p->getPrefix() !== null) {
$newP->setPrefix($p->getPrefix());
}
if ($p->getRefid() !== null) {
$newP->setRefid($p->getRefid());
}
if ($p->getEnvironment() !== null) {
$newP->setEnvironment($p->getEnvironment());
}
if ($p->getUserProperty() !== null) {
$newP->setUserProperty($p->getUserProperty());
}
$newP->setOverride($p->getOverride());
$newP->setLogoutput($p->getLogoutput());
$newP->setQuiet($p->getQuiet());
$this->properties[$i] = $newP;
}
} | php | private function reinit()
{
$this->init();
$count = count($this->properties);
for ($i = 0; $i < $count; $i++) {
/**
* @var PropertyTask $p
*/
$p = $this->properties[$i];
/**
* @var PropertyTask $newP
*/
$newP = $this->newProject->createTask("property");
$newP->setName($p->getName());
if ($p->getValue() !== null) {
$newP->setValue($p->getValue());
}
if ($p->getFile() !== null) {
$newP->setFile($p->getFile());
}
if ($p->getPrefix() !== null) {
$newP->setPrefix($p->getPrefix());
}
if ($p->getRefid() !== null) {
$newP->setRefid($p->getRefid());
}
if ($p->getEnvironment() !== null) {
$newP->setEnvironment($p->getEnvironment());
}
if ($p->getUserProperty() !== null) {
$newP->setUserProperty($p->getUserProperty());
}
$newP->setOverride($p->getOverride());
$newP->setLogoutput($p->getLogoutput());
$newP->setQuiet($p->getQuiet());
$this->properties[$i] = $newP;
}
} | [
"private",
"function",
"reinit",
"(",
")",
"{",
"$",
"this",
"->",
"init",
"(",
")",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
"->",
"properties",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"count",
";",
"$",
... | Called in execute or createProperty if newProject is null.
<p>This can happen if the same instance of this task is run
twice as newProject is set to null at the end of execute (to
save memory and help the GC).</p>
<p>Sets all properties that have been defined as nested
property elements.</p> | [
"Called",
"in",
"execute",
"or",
"createProperty",
"if",
"newProject",
"is",
"null",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PhingTask.php#L122-L160 | train |
phingofficial/phing | classes/phing/tasks/system/PhingTask.php | PhingTask.main | public function main()
{
// Call Phing on the file set with the attribute "phingfile"
if ($this->phingFile !== null or $this->dir !== null) {
$this->processFile();
}
// if no filesets are given stop here; else process filesets
if (!empty($this->filesets)) {
// preserve old settings
$savedDir = $this->dir;
$savedPhingFile = $this->phingFile;
$savedTarget = $this->newTarget;
// set no specific target for files in filesets
// [HL] I'm commenting this out; I don't know why this should not be supported!
// $this->newTarget = null;
foreach ($this->filesets as $fs) {
$ds = $fs->getDirectoryScanner($this->project);
$fromDir = $fs->getDir($this->project);
$srcFiles = $ds->getIncludedFiles();
foreach ($srcFiles as $fname) {
$f = new PhingFile($ds->getbasedir(), $fname);
$f = $f->getAbsoluteFile();
$this->phingFile = $f->getAbsolutePath();
$this->dir = $f->getParentFile();
$this->processFile(); // run Phing!
}
}
// side effect free programming ;-)
$this->dir = $savedDir;
$this->phingFile = $savedPhingFile;
$this->newTarget = $savedTarget;
// [HL] change back to correct dir
if ($this->dir !== null) {
chdir($this->dir->getAbsolutePath());
}
}
// Remove any dangling references to help the GC
foreach ($this->properties as $property) {
$property->setFallback(null);
}
} | php | public function main()
{
// Call Phing on the file set with the attribute "phingfile"
if ($this->phingFile !== null or $this->dir !== null) {
$this->processFile();
}
// if no filesets are given stop here; else process filesets
if (!empty($this->filesets)) {
// preserve old settings
$savedDir = $this->dir;
$savedPhingFile = $this->phingFile;
$savedTarget = $this->newTarget;
// set no specific target for files in filesets
// [HL] I'm commenting this out; I don't know why this should not be supported!
// $this->newTarget = null;
foreach ($this->filesets as $fs) {
$ds = $fs->getDirectoryScanner($this->project);
$fromDir = $fs->getDir($this->project);
$srcFiles = $ds->getIncludedFiles();
foreach ($srcFiles as $fname) {
$f = new PhingFile($ds->getbasedir(), $fname);
$f = $f->getAbsoluteFile();
$this->phingFile = $f->getAbsolutePath();
$this->dir = $f->getParentFile();
$this->processFile(); // run Phing!
}
}
// side effect free programming ;-)
$this->dir = $savedDir;
$this->phingFile = $savedPhingFile;
$this->newTarget = $savedTarget;
// [HL] change back to correct dir
if ($this->dir !== null) {
chdir($this->dir->getAbsolutePath());
}
}
// Remove any dangling references to help the GC
foreach ($this->properties as $property) {
$property->setFallback(null);
}
} | [
"public",
"function",
"main",
"(",
")",
"{",
"// Call Phing on the file set with the attribute \"phingfile\"",
"if",
"(",
"$",
"this",
"->",
"phingFile",
"!==",
"null",
"or",
"$",
"this",
"->",
"dir",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"processFile",
... | Main entry point for the task.
@return void | [
"Main",
"entry",
"point",
"for",
"the",
"task",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PhingTask.php#L167-L216 | train |
phingofficial/phing | classes/phing/tasks/system/PhingTask.php | PhingTask.overrideProperties | private function overrideProperties()
{
foreach (array_keys($this->properties) as $i) {
$p = $this->properties[$i];
$p->setProject($this->newProject);
$p->main();
}
$this->project->copyInheritedProperties($this->newProject);
} | php | private function overrideProperties()
{
foreach (array_keys($this->properties) as $i) {
$p = $this->properties[$i];
$p->setProject($this->newProject);
$p->main();
}
$this->project->copyInheritedProperties($this->newProject);
} | [
"private",
"function",
"overrideProperties",
"(",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"properties",
")",
"as",
"$",
"i",
")",
"{",
"$",
"p",
"=",
"$",
"this",
"->",
"properties",
"[",
"$",
"i",
"]",
";",
"$",
"p",
"->",
... | Override the properties in the new project with the one
explicitly defined as nested elements here.
@return void
@throws BuildException | [
"Override",
"the",
"properties",
"in",
"the",
"new",
"project",
"with",
"the",
"one",
"explicitly",
"defined",
"as",
"nested",
"elements",
"here",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PhingTask.php#L411-L419 | train |
phingofficial/phing | classes/phing/tasks/system/PhingTask.php | PhingTask.addReferences | private function addReferences()
{
// parent project references
$projReferences = $this->project->getReferences();
$newReferences = $this->newProject->getReferences();
$subprojRefKeys = [];
if (count($this->references) > 0) {
for ($i = 0, $count = count($this->references); $i < $count; $i++) {
$ref = $this->references[$i];
$refid = $ref->getRefId();
if ($refid === null) {
throw new BuildException(
"the refid attribute is required"
. " for reference elements"
);
}
if (!isset($projReferences[$refid])) {
$this->log(
"Parent project doesn't contain any reference '"
. $refid . "'",
Project::MSG_WARN
);
continue;
}
$subprojRefKeys[] = $refid;
//thisReferences.remove(refid);
$toRefid = $ref->getToRefid();
if ($toRefid === null) {
$toRefid = $refid;
}
$this->copyReference($refid, $toRefid);
}
}
// Now add all references that are not defined in the
// subproject, if inheritRefs is true
if ($this->inheritRefs) {
// get the keys that are were not used by the subproject
$unusedRefKeys = array_diff(array_keys($projReferences), $subprojRefKeys);
foreach ($unusedRefKeys as $key) {
if (isset($newReferences[$key])) {
continue;
}
$this->copyReference($key, $key);
}
}
} | php | private function addReferences()
{
// parent project references
$projReferences = $this->project->getReferences();
$newReferences = $this->newProject->getReferences();
$subprojRefKeys = [];
if (count($this->references) > 0) {
for ($i = 0, $count = count($this->references); $i < $count; $i++) {
$ref = $this->references[$i];
$refid = $ref->getRefId();
if ($refid === null) {
throw new BuildException(
"the refid attribute is required"
. " for reference elements"
);
}
if (!isset($projReferences[$refid])) {
$this->log(
"Parent project doesn't contain any reference '"
. $refid . "'",
Project::MSG_WARN
);
continue;
}
$subprojRefKeys[] = $refid;
//thisReferences.remove(refid);
$toRefid = $ref->getToRefid();
if ($toRefid === null) {
$toRefid = $refid;
}
$this->copyReference($refid, $toRefid);
}
}
// Now add all references that are not defined in the
// subproject, if inheritRefs is true
if ($this->inheritRefs) {
// get the keys that are were not used by the subproject
$unusedRefKeys = array_diff(array_keys($projReferences), $subprojRefKeys);
foreach ($unusedRefKeys as $key) {
if (isset($newReferences[$key])) {
continue;
}
$this->copyReference($key, $key);
}
}
} | [
"private",
"function",
"addReferences",
"(",
")",
"{",
"// parent project references",
"$",
"projReferences",
"=",
"$",
"this",
"->",
"project",
"->",
"getReferences",
"(",
")",
";",
"$",
"newReferences",
"=",
"$",
"this",
"->",
"newProject",
"->",
"getReference... | Add the references explicitly defined as nested elements to the
new project. Also copy over all references that don't override
existing references in the new project if inheritrefs has been
requested.
@return void
@throws BuildException | [
"Add",
"the",
"references",
"explicitly",
"defined",
"as",
"nested",
"elements",
"to",
"the",
"new",
"project",
".",
"Also",
"copy",
"over",
"all",
"references",
"that",
"don",
"t",
"override",
"existing",
"references",
"in",
"the",
"new",
"project",
"if",
"... | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PhingTask.php#L430-L483 | train |
phingofficial/phing | classes/phing/tasks/system/PhingTask.php | PhingTask.copyReference | private function copyReference($oldKey, $newKey)
{
$orig = $this->project->getReference($oldKey);
if ($orig === null) {
$this->log(
"No object referenced by " . $oldKey . ". Can't copy to "
. $newKey,
Project::MSG_WARN
);
return;
}
$copy = clone $orig;
if ($copy instanceof ProjectComponent) {
$copy->setProject($this->newProject);
} elseif (in_array('setProject', get_class_methods(get_class($copy)))) {
$copy->setProject($this->newProject);
} elseif ($copy instanceof Project) {
// don't copy the old "Project" itself
} else {
$msg = "Error setting new project instance for "
. "reference with id " . $oldKey;
throw new BuildException($msg);
}
$this->newProject->addReference($newKey, $copy);
} | php | private function copyReference($oldKey, $newKey)
{
$orig = $this->project->getReference($oldKey);
if ($orig === null) {
$this->log(
"No object referenced by " . $oldKey . ". Can't copy to "
. $newKey,
Project::MSG_WARN
);
return;
}
$copy = clone $orig;
if ($copy instanceof ProjectComponent) {
$copy->setProject($this->newProject);
} elseif (in_array('setProject', get_class_methods(get_class($copy)))) {
$copy->setProject($this->newProject);
} elseif ($copy instanceof Project) {
// don't copy the old "Project" itself
} else {
$msg = "Error setting new project instance for "
. "reference with id " . $oldKey;
throw new BuildException($msg);
}
$this->newProject->addReference($newKey, $copy);
} | [
"private",
"function",
"copyReference",
"(",
"$",
"oldKey",
",",
"$",
"newKey",
")",
"{",
"$",
"orig",
"=",
"$",
"this",
"->",
"project",
"->",
"getReference",
"(",
"$",
"oldKey",
")",
";",
"if",
"(",
"$",
"orig",
"===",
"null",
")",
"{",
"$",
"thi... | Try to clone and reconfigure the object referenced by oldkey in
the parent project and add it to the new project with the key
newkey.
<p>If we cannot clone it, copy the referenced object itself and
keep our fingers crossed.</p>
@param string $oldKey
@param string $newKey
@throws BuildException
@return void | [
"Try",
"to",
"clone",
"and",
"reconfigure",
"the",
"object",
"referenced",
"by",
"oldkey",
"in",
"the",
"parent",
"project",
"and",
"add",
"it",
"to",
"the",
"new",
"project",
"with",
"the",
"key",
"newkey",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PhingTask.php#L498-L526 | train |
phingofficial/phing | classes/phing/tasks/system/PhingTask.php | PhingTask.setDir | public function setDir($d)
{
if (is_string($d)) {
$this->dir = new PhingFile($d);
} else {
$this->dir = $d;
}
} | php | public function setDir($d)
{
if (is_string($d)) {
$this->dir = new PhingFile($d);
} else {
$this->dir = $d;
}
} | [
"public",
"function",
"setDir",
"(",
"$",
"d",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"d",
")",
")",
"{",
"$",
"this",
"->",
"dir",
"=",
"new",
"PhingFile",
"(",
"$",
"d",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"dir",
"=",
"$",
... | The directory to use as a base directory for the new phing project.
Defaults to the current project's basedir, unless inheritall
has been set to false, in which case it doesn't have a default
value. This will override the basedir setting of the called project.
@param $d | [
"The",
"directory",
"to",
"use",
"as",
"a",
"base",
"directory",
"for",
"the",
"new",
"phing",
"project",
".",
"Defaults",
"to",
"the",
"current",
"project",
"s",
"basedir",
"unless",
"inheritall",
"has",
"been",
"set",
"to",
"false",
"in",
"which",
"case"... | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PhingTask.php#L558-L565 | train |
phingofficial/phing | classes/phing/tasks/system/PhingTask.php | PhingTask.createProperty | public function createProperty()
{
$p = new PropertyTask();
$p->setFallback($this->getNewProject());
$p->setUserProperty(true);
$this->properties[] = $p;
return $p;
} | php | public function createProperty()
{
$p = new PropertyTask();
$p->setFallback($this->getNewProject());
$p->setUserProperty(true);
$this->properties[] = $p;
return $p;
} | [
"public",
"function",
"createProperty",
"(",
")",
"{",
"$",
"p",
"=",
"new",
"PropertyTask",
"(",
")",
";",
"$",
"p",
"->",
"setFallback",
"(",
"$",
"this",
"->",
"getNewProject",
"(",
")",
")",
";",
"$",
"p",
"->",
"setUserProperty",
"(",
"true",
")... | Property to pass to the new project.
The property is passed as a 'user property' | [
"Property",
"to",
"pass",
"to",
"the",
"new",
"project",
".",
"The",
"property",
"is",
"passed",
"as",
"a",
"user",
"property"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/PhingTask.php#L611-L619 | train |
phingofficial/phing | classes/phing/tasks/ext/sass/SassTask.php | SassTask.setEncoding | public function setEncoding($encoding)
{
$encoding = trim($encoding);
if ($encoding !== '') {
$this->flags .= " --default-encoding $encoding";
} else {
$this->flags = str_replace(
' --default-encoding ' . $this->encoding,
'',
$this->flags
);
}
$this->encoding = $encoding;
} | php | public function setEncoding($encoding)
{
$encoding = trim($encoding);
if ($encoding !== '') {
$this->flags .= " --default-encoding $encoding";
} else {
$this->flags = str_replace(
' --default-encoding ' . $this->encoding,
'',
$this->flags
);
}
$this->encoding = $encoding;
} | [
"public",
"function",
"setEncoding",
"(",
"$",
"encoding",
")",
"{",
"$",
"encoding",
"=",
"trim",
"(",
"$",
"encoding",
")",
";",
"if",
"(",
"$",
"encoding",
"!==",
"''",
")",
"{",
"$",
"this",
"->",
"flags",
".=",
"\" --default-encoding $encoding\"",
"... | Set default encoding
@param string $encoding Default encoding to use.
@return void | [
"Set",
"default",
"encoding"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sass/SassTask.php#L344-L357 | train |
phingofficial/phing | classes/phing/tasks/ext/sass/SassTask.php | SassTask.setCheck | public function setCheck($value)
{
$check = StringHelper::booleanValue($value);
$this->check = $check;
if ($check) {
$this->flags .= ' --check ';
} else {
$this->flags = str_replace(' --check ', '', $this->flags);
}
} | php | public function setCheck($value)
{
$check = StringHelper::booleanValue($value);
$this->check = $check;
if ($check) {
$this->flags .= ' --check ';
} else {
$this->flags = str_replace(' --check ', '', $this->flags);
}
} | [
"public",
"function",
"setCheck",
"(",
"$",
"value",
")",
"{",
"$",
"check",
"=",
"StringHelper",
"::",
"booleanValue",
"(",
"$",
"value",
")",
";",
"$",
"this",
"->",
"check",
"=",
"$",
"check",
";",
"if",
"(",
"$",
"check",
")",
"{",
"$",
"this",... | Whether to just check syntax.
@param string $value Jenkins style boolean value
@return void | [
"Whether",
"to",
"just",
"check",
"syntax",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sass/SassTask.php#L467-L476 | train |
phingofficial/phing | classes/phing/tasks/ext/sass/SassTask.php | SassTask.setCompressed | public function setCompressed($value)
{
$compress = StringHelper::booleanValue($value);
if ($compress) {
$this->flags = str_replace(' --style ' . $this->style, '', $this->flags);
$this->flags .= ' --style compressed';
$this->style = 'compressed';
}
} | php | public function setCompressed($value)
{
$compress = StringHelper::booleanValue($value);
if ($compress) {
$this->flags = str_replace(' --style ' . $this->style, '', $this->flags);
$this->flags .= ' --style compressed';
$this->style = 'compressed';
}
} | [
"public",
"function",
"setCompressed",
"(",
"$",
"value",
")",
"{",
"$",
"compress",
"=",
"StringHelper",
"::",
"booleanValue",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"compress",
")",
"{",
"$",
"this",
"->",
"flags",
"=",
"str_replace",
"(",
"' -... | Set style to compressed
@param string $value Jenkins style boolean value
@return void | [
"Set",
"style",
"to",
"compressed"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sass/SassTask.php#L523-L531 | train |
phingofficial/phing | classes/phing/tasks/ext/sass/SassTask.php | SassTask.setExpand | public function setExpand($value)
{
$expand = StringHelper::booleanValue($value);
if ($expand) {
$this->flags = str_replace(' --style ' . $this->style, '', $this->flags);
$this->flags .= ' --style expanded';
$this->style = 'expanded';
}
} | php | public function setExpand($value)
{
$expand = StringHelper::booleanValue($value);
if ($expand) {
$this->flags = str_replace(' --style ' . $this->style, '', $this->flags);
$this->flags .= ' --style expanded';
$this->style = 'expanded';
}
} | [
"public",
"function",
"setExpand",
"(",
"$",
"value",
")",
"{",
"$",
"expand",
"=",
"StringHelper",
"::",
"booleanValue",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"expand",
")",
"{",
"$",
"this",
"->",
"flags",
"=",
"str_replace",
"(",
"' --style '... | Set style to expanded
@param string $value Jenkins style boolean value
@return void | [
"Set",
"style",
"to",
"expanded"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sass/SassTask.php#L577-L585 | train |
phingofficial/phing | classes/phing/tasks/ext/sass/SassTask.php | SassTask.setNested | public function setNested($value)
{
$nested = StringHelper::booleanValue($value);
if ($nested) {
$this->flags = str_replace(' --style ' . $this->style, '', $this->flags);
$this->flags .= ' --style nested';
$this->style = 'nested';
}
} | php | public function setNested($value)
{
$nested = StringHelper::booleanValue($value);
if ($nested) {
$this->flags = str_replace(' --style ' . $this->style, '', $this->flags);
$this->flags .= ' --style nested';
$this->style = 'nested';
}
} | [
"public",
"function",
"setNested",
"(",
"$",
"value",
")",
"{",
"$",
"nested",
"=",
"StringHelper",
"::",
"booleanValue",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"nested",
")",
"{",
"$",
"this",
"->",
"flags",
"=",
"str_replace",
"(",
"' --style '... | Set style to nested
@param string $value Jenkins style boolean value
@return void | [
"Set",
"style",
"to",
"nested"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sass/SassTask.php#L605-L613 | train |
phingofficial/phing | classes/phing/tasks/ext/sass/SassTask.php | SassTask.setNoCache | public function setNoCache($value)
{
$noCache = StringHelper::booleanValue($value);
$this->noCache = $noCache;
if ($noCache) {
$this->flags .= ' --no-cache ';
} else {
$this->flags = str_replace(' --no-cache ', '', $this->flags);
}
} | php | public function setNoCache($value)
{
$noCache = StringHelper::booleanValue($value);
$this->noCache = $noCache;
if ($noCache) {
$this->flags .= ' --no-cache ';
} else {
$this->flags = str_replace(' --no-cache ', '', $this->flags);
}
} | [
"public",
"function",
"setNoCache",
"(",
"$",
"value",
")",
"{",
"$",
"noCache",
"=",
"StringHelper",
"::",
"booleanValue",
"(",
"$",
"value",
")",
";",
"$",
"this",
"->",
"noCache",
"=",
"$",
"noCache",
";",
"if",
"(",
"$",
"noCache",
")",
"{",
"$",... | Whether to cache parsed sass files.
@param string $value Jenkins style boolean value
@return void | [
"Whether",
"to",
"cache",
"parsed",
"sass",
"files",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sass/SassTask.php#L661-L670 | train |
phingofficial/phing | classes/phing/tasks/ext/sass/SassTask.php | SassTask.setStyle | public function setStyle(string $style): void
{
$style = strtolower($style);
switch ($style) {
case 'nested':
case 'compact':
case 'compressed':
case 'expanded':
case 'crunched':
$this->flags = str_replace(" --style $this->style", '', $this->flags);
$this->style = $style;
$this->flags .= " --style $style";
break;
default:
$this->log("Style $style ignored", Project::MSG_INFO);
}
} | php | public function setStyle(string $style): void
{
$style = strtolower($style);
switch ($style) {
case 'nested':
case 'compact':
case 'compressed':
case 'expanded':
case 'crunched':
$this->flags = str_replace(" --style $this->style", '', $this->flags);
$this->style = $style;
$this->flags .= " --style $style";
break;
default:
$this->log("Style $style ignored", Project::MSG_INFO);
}
} | [
"public",
"function",
"setStyle",
"(",
"string",
"$",
"style",
")",
":",
"void",
"{",
"$",
"style",
"=",
"strtolower",
"(",
"$",
"style",
")",
";",
"switch",
"(",
"$",
"style",
")",
"{",
"case",
"'nested'",
":",
"case",
"'compact'",
":",
"case",
"'co... | Set output style.
@param string $style nested|compact|compressed|expanded|crunched
@return void | [
"Set",
"output",
"style",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sass/SassTask.php#L710-L726 | train |
phingofficial/phing | classes/phing/tasks/ext/sass/SassTask.php | SassTask.setTrace | public function setTrace($trace)
{
$this->trace = StringHelper::booleanValue($trace);
if ($this->trace) {
$this->flags .= ' --trace ';
} else {
$this->flags = str_replace(' --trace ', '', $this->flags);
}
} | php | public function setTrace($trace)
{
$this->trace = StringHelper::booleanValue($trace);
if ($this->trace) {
$this->flags .= ' --trace ';
} else {
$this->flags = str_replace(' --trace ', '', $this->flags);
}
} | [
"public",
"function",
"setTrace",
"(",
"$",
"trace",
")",
"{",
"$",
"this",
"->",
"trace",
"=",
"StringHelper",
"::",
"booleanValue",
"(",
"$",
"trace",
")",
";",
"if",
"(",
"$",
"this",
"->",
"trace",
")",
"{",
"$",
"this",
"->",
"flags",
".=",
"'... | Set trace option.
IE: Whether to output a stack trace on error.
@param string $trace Jenkins style boolean value
@return void | [
"Set",
"trace",
"option",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sass/SassTask.php#L745-L753 | train |
phingofficial/phing | classes/phing/tasks/ext/sass/SassTask.php | SassTask.setUnixnewlines | public function setUnixnewlines($newlines)
{
$unixnewlines = StringHelper::booleanValue($newlines);
$this->unixnewlines = $unixnewlines;
if ($unixnewlines) {
$this->flags .= ' --unix-newlines ';
} else {
$this->flags = str_replace(' --unix-newlines ', '', $this->flags);
}
} | php | public function setUnixnewlines($newlines)
{
$unixnewlines = StringHelper::booleanValue($newlines);
$this->unixnewlines = $unixnewlines;
if ($unixnewlines) {
$this->flags .= ' --unix-newlines ';
} else {
$this->flags = str_replace(' --unix-newlines ', '', $this->flags);
}
} | [
"public",
"function",
"setUnixnewlines",
"(",
"$",
"newlines",
")",
"{",
"$",
"unixnewlines",
"=",
"StringHelper",
"::",
"booleanValue",
"(",
"$",
"newlines",
")",
";",
"$",
"this",
"->",
"unixnewlines",
"=",
"$",
"unixnewlines",
";",
"if",
"(",
"$",
"unix... | Whether to use unix-style newlines.
@param string $newlines Jenkins style boolean value
@return void | [
"Whether",
"to",
"use",
"unix",
"-",
"style",
"newlines",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sass/SassTask.php#L772-L781 | train |
phingofficial/phing | classes/phing/tasks/ext/sass/SassTask.php | SassTask.setLineNumbers | public function setLineNumbers(string $lineNumbers): void
{
$lineNumbers = StringHelper::booleanValue($lineNumbers);
$this->lineNumbers = $lineNumbers;
if ($lineNumbers) {
$this->flags .= ' --line-numbers ';
} else {
$this->flags = str_replace(' --line-numbers ', '', $this->flags);
}
} | php | public function setLineNumbers(string $lineNumbers): void
{
$lineNumbers = StringHelper::booleanValue($lineNumbers);
$this->lineNumbers = $lineNumbers;
if ($lineNumbers) {
$this->flags .= ' --line-numbers ';
} else {
$this->flags = str_replace(' --line-numbers ', '', $this->flags);
}
} | [
"public",
"function",
"setLineNumbers",
"(",
"string",
"$",
"lineNumbers",
")",
":",
"void",
"{",
"$",
"lineNumbers",
"=",
"StringHelper",
"::",
"booleanValue",
"(",
"$",
"lineNumbers",
")",
";",
"$",
"this",
"->",
"lineNumbers",
"=",
"$",
"lineNumbers",
";"... | Whether to identify source-file and line number for generated CSS.
@param string $lineNumbers Jenkins style boolean value | [
"Whether",
"to",
"identify",
"source",
"-",
"file",
"and",
"line",
"number",
"for",
"generated",
"CSS",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sass/SassTask.php#L798-L807 | train |
phingofficial/phing | classes/phing/tasks/ext/sass/SassTask.php | SassTask.main | public function main()
{
if ($this->useSass) {
if (strlen($this->executable) < 0) {
throw new BuildException("'executable' must be defined.");
}
}
if (empty($this->filesets) && $this->file === null) {
throw new BuildException(
"Missing either a nested fileset or attribute 'file'"
);
}
try {
$compiler = (new SassTaskCompilerFactory(FileSystem::getFileSystem()))->prepareCompiler($this);
} catch (BuildException $exception) {
if ($this->failonerror) {
throw $exception;
}
$this->log($exception->getMessage());
return;
}
if (count($this->filesets) > 0) {
$this->processFilesets($compiler);
} elseif ($this->file !== null) {
$this->processFile($compiler);
}
} | php | public function main()
{
if ($this->useSass) {
if (strlen($this->executable) < 0) {
throw new BuildException("'executable' must be defined.");
}
}
if (empty($this->filesets) && $this->file === null) {
throw new BuildException(
"Missing either a nested fileset or attribute 'file'"
);
}
try {
$compiler = (new SassTaskCompilerFactory(FileSystem::getFileSystem()))->prepareCompiler($this);
} catch (BuildException $exception) {
if ($this->failonerror) {
throw $exception;
}
$this->log($exception->getMessage());
return;
}
if (count($this->filesets) > 0) {
$this->processFilesets($compiler);
} elseif ($this->file !== null) {
$this->processFile($compiler);
}
} | [
"public",
"function",
"main",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useSass",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"this",
"->",
"executable",
")",
"<",
"0",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"'executable' must be defined.\""... | Our main execution of the task.
@throws BuildException
@throws Exception
@access public
@return void | [
"Our",
"main",
"execution",
"of",
"the",
"task",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sass/SassTask.php#L895-L924 | train |
phingofficial/phing | classes/phing/tasks/ext/sass/SassTask.php | SassTask.processFile | public function processFile(SassTaskCompiler $compiler)
{
$this->log("Process file", Project::MSG_INFO);
if (null === $this->output) {
$specifiedOutputPath = (strlen($this->outputpath) > 0);
if ($specifiedOutputPath === false) {
$info = pathinfo($this->file);
$path = $info['dirname'];
$this->outputpath = $path;
} else {
$path = $this->outputpath;
}
$output = $path . DIRECTORY_SEPARATOR . $info['filename'];
if (!$this->removeoldext) {
$output .= '.' . $this->pathInfo['extension'];
}
if (strlen($this->newext) > 0) {
$output .= '.' . $this->newext;
}
$this->output = $output;
} else {
$output = $this->output;
}
$compiler->compile($this->file, $output, $this->failonerror);
} | php | public function processFile(SassTaskCompiler $compiler)
{
$this->log("Process file", Project::MSG_INFO);
if (null === $this->output) {
$specifiedOutputPath = (strlen($this->outputpath) > 0);
if ($specifiedOutputPath === false) {
$info = pathinfo($this->file);
$path = $info['dirname'];
$this->outputpath = $path;
} else {
$path = $this->outputpath;
}
$output = $path . DIRECTORY_SEPARATOR . $info['filename'];
if (!$this->removeoldext) {
$output .= '.' . $this->pathInfo['extension'];
}
if (strlen($this->newext) > 0) {
$output .= '.' . $this->newext;
}
$this->output = $output;
} else {
$output = $this->output;
}
$compiler->compile($this->file, $output, $this->failonerror);
} | [
"public",
"function",
"processFile",
"(",
"SassTaskCompiler",
"$",
"compiler",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"Process file\"",
",",
"Project",
"::",
"MSG_INFO",
")",
";",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"output",
")",
"{",
"$",
... | Compile a specified file.
If output file is not specified, but outputpath is, place output in
that directory. If neither is specified, place .css file in the
directory that the input file is in.
@param SassTaskCompiler $compiler Compiler to use for processing fileset
@return void | [
"Compile",
"a",
"specified",
"file",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sass/SassTask.php#L937-L963 | train |
phingofficial/phing | classes/phing/tasks/ext/sass/SassTask.php | SassTask.buildOutputFilePath | protected function buildOutputFilePath()
{
$outputFile = $this->outputpath . DIRECTORY_SEPARATOR;
$subpath = trim($this->pathInfo['dirname'], ' .');
if ($this->keepsubdirectories === true && strlen($subpath) > 0) {
$outputFile .= $subpath . DIRECTORY_SEPARATOR;
}
$outputFile .= $this->pathInfo['filename'];
if (!$this->removeoldext) {
$outputFile .= '.' . $this->pathInfo['extension'];
}
if (strlen($this->newext) > 0) {
$outputFile .= '.' . $this->newext;
}
return $outputFile;
} | php | protected function buildOutputFilePath()
{
$outputFile = $this->outputpath . DIRECTORY_SEPARATOR;
$subpath = trim($this->pathInfo['dirname'], ' .');
if ($this->keepsubdirectories === true && strlen($subpath) > 0) {
$outputFile .= $subpath . DIRECTORY_SEPARATOR;
}
$outputFile .= $this->pathInfo['filename'];
if (!$this->removeoldext) {
$outputFile .= '.' . $this->pathInfo['extension'];
}
if (strlen($this->newext) > 0) {
$outputFile .= '.' . $this->newext;
}
return $outputFile;
} | [
"protected",
"function",
"buildOutputFilePath",
"(",
")",
"{",
"$",
"outputFile",
"=",
"$",
"this",
"->",
"outputpath",
".",
"DIRECTORY_SEPARATOR",
";",
"$",
"subpath",
"=",
"trim",
"(",
"$",
"this",
"->",
"pathInfo",
"[",
"'dirname'",
"]",
",",
"' .'",
")... | Builds the full path to the output file based on our settings.
@return string
@access protected | [
"Builds",
"the",
"full",
"path",
"to",
"the",
"output",
"file",
"based",
"on",
"our",
"settings",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/sass/SassTask.php#L1017-L1038 | train |
phingofficial/phing | classes/phing/tasks/ext/phpdoc/PhpDocumentor2Task.php | PhpDocumentor2Task.initializePhpDocumentor | private function initializePhpDocumentor()
{
$phpDocumentorPath = '';
if (!empty($this->pharLocation)) {
include_once 'phar://' . $this->pharLocation . '/vendor/autoload.php';
if (!class_exists('phpDocumentor\\Bootstrap')) {
throw new BuildException(
$this->pharLocation . ' does not look like a phpDocumentor 2 .phar'
);
}
} elseif (class_exists('Composer\\Autoload\\ClassLoader', false)) {
if (!class_exists('phpDocumentor\\Bootstrap')) {
throw new BuildException('You need to install phpDocumentor 2 or add your include path to your composer installation.');
}
} else {
$phpDocumentorPath = $this->findPhpDocumentorPath();
if (empty($phpDocumentorPath)) {
throw new BuildException("Please make sure phpDocumentor 2 is installed and on the include_path.");
}
set_include_path($phpDocumentorPath . PATH_SEPARATOR . get_include_path());
include_once $phpDocumentorPath . '/phpDocumentor/Bootstrap.php';
}
$this->app = \phpDocumentor\Bootstrap::createInstance()->initialize();
$this->phpDocumentorPath = $phpDocumentorPath;
} | php | private function initializePhpDocumentor()
{
$phpDocumentorPath = '';
if (!empty($this->pharLocation)) {
include_once 'phar://' . $this->pharLocation . '/vendor/autoload.php';
if (!class_exists('phpDocumentor\\Bootstrap')) {
throw new BuildException(
$this->pharLocation . ' does not look like a phpDocumentor 2 .phar'
);
}
} elseif (class_exists('Composer\\Autoload\\ClassLoader', false)) {
if (!class_exists('phpDocumentor\\Bootstrap')) {
throw new BuildException('You need to install phpDocumentor 2 or add your include path to your composer installation.');
}
} else {
$phpDocumentorPath = $this->findPhpDocumentorPath();
if (empty($phpDocumentorPath)) {
throw new BuildException("Please make sure phpDocumentor 2 is installed and on the include_path.");
}
set_include_path($phpDocumentorPath . PATH_SEPARATOR . get_include_path());
include_once $phpDocumentorPath . '/phpDocumentor/Bootstrap.php';
}
$this->app = \phpDocumentor\Bootstrap::createInstance()->initialize();
$this->phpDocumentorPath = $phpDocumentorPath;
} | [
"private",
"function",
"initializePhpDocumentor",
"(",
")",
"{",
"$",
"phpDocumentorPath",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"pharLocation",
")",
")",
"{",
"include_once",
"'phar://'",
".",
"$",
"this",
"->",
"pharLocation",
... | Finds and initializes the phpDocumentor installation | [
"Finds",
"and",
"initializes",
"the",
"phpDocumentor",
"installation"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/phpdoc/PhpDocumentor2Task.php#L141-L172 | train |
phingofficial/phing | classes/phing/tasks/ext/phpdoc/PhpDocumentor2Task.php | PhpDocumentor2Task.transformFiles | private function transformFiles()
{
$transformer = $this->app['transformer'];
$compiler = $this->app['compiler'];
$builder = $this->app['descriptor.builder'];
$projectDescriptor = $builder->getProjectDescriptor();
$transformer->getTemplates()->load($this->template, $transformer);
$transformer->setTarget($this->destDir->getAbsolutePath());
foreach ($compiler as $pass) {
$pass->execute($projectDescriptor);
}
} | php | private function transformFiles()
{
$transformer = $this->app['transformer'];
$compiler = $this->app['compiler'];
$builder = $this->app['descriptor.builder'];
$projectDescriptor = $builder->getProjectDescriptor();
$transformer->getTemplates()->load($this->template, $transformer);
$transformer->setTarget($this->destDir->getAbsolutePath());
foreach ($compiler as $pass) {
$pass->execute($projectDescriptor);
}
} | [
"private",
"function",
"transformFiles",
"(",
")",
"{",
"$",
"transformer",
"=",
"$",
"this",
"->",
"app",
"[",
"'transformer'",
"]",
";",
"$",
"compiler",
"=",
"$",
"this",
"->",
"app",
"[",
"'compiler'",
"]",
";",
"$",
"builder",
"=",
"$",
"this",
... | Transforms the parsed files | [
"Transforms",
"the",
"parsed",
"files"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/phpdoc/PhpDocumentor2Task.php#L224-L237 | train |
phingofficial/phing | classes/phing/tasks/ext/phpdoc/PhpDocumentor2Task.php | PhpDocumentor2Task.findPhpDocumentorPath | private function findPhpDocumentorPath()
{
$phpDocumentorPath = null;
$directories = ['phpDocumentor', 'phpdocumentor'];
foreach ($directories as $directory) {
foreach (Phing::explodeIncludePath() as $path) {
$testPhpDocumentorPath = $path . DIRECTORY_SEPARATOR . $directory . DIRECTORY_SEPARATOR . 'src';
if (file_exists($testPhpDocumentorPath)) {
$phpDocumentorPath = $testPhpDocumentorPath;
}
}
}
return $phpDocumentorPath;
} | php | private function findPhpDocumentorPath()
{
$phpDocumentorPath = null;
$directories = ['phpDocumentor', 'phpdocumentor'];
foreach ($directories as $directory) {
foreach (Phing::explodeIncludePath() as $path) {
$testPhpDocumentorPath = $path . DIRECTORY_SEPARATOR . $directory . DIRECTORY_SEPARATOR . 'src';
if (file_exists($testPhpDocumentorPath)) {
$phpDocumentorPath = $testPhpDocumentorPath;
}
}
}
return $phpDocumentorPath;
} | [
"private",
"function",
"findPhpDocumentorPath",
"(",
")",
"{",
"$",
"phpDocumentorPath",
"=",
"null",
";",
"$",
"directories",
"=",
"[",
"'phpDocumentor'",
",",
"'phpdocumentor'",
"]",
";",
"foreach",
"(",
"$",
"directories",
"as",
"$",
"directory",
")",
"{",
... | Find the correct php documentor path
@return null|string | [
"Find",
"the",
"correct",
"php",
"documentor",
"path"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/phpdoc/PhpDocumentor2Task.php#L251-L265 | train |
phingofficial/phing | classes/phing/tasks/ext/UnzipTask.php | UnzipTask.listArchiveContent | protected function listArchiveContent(PhingFile $zipfile)
{
$zip = new ZipArchive();
$zip->open($zipfile->getAbsolutePath());
$content = [];
for ($i = 0; $i < $zip->numFiles; $i++) {
$content[] = [
'filename' => $zip->getNameIndex($i)
];
}
return $content;
} | php | protected function listArchiveContent(PhingFile $zipfile)
{
$zip = new ZipArchive();
$zip->open($zipfile->getAbsolutePath());
$content = [];
for ($i = 0; $i < $zip->numFiles; $i++) {
$content[] = [
'filename' => $zip->getNameIndex($i)
];
}
return $content;
} | [
"protected",
"function",
"listArchiveContent",
"(",
"PhingFile",
"$",
"zipfile",
")",
"{",
"$",
"zip",
"=",
"new",
"ZipArchive",
"(",
")",
";",
"$",
"zip",
"->",
"open",
"(",
"$",
"zipfile",
"->",
"getAbsolutePath",
"(",
")",
")",
";",
"$",
"content",
... | List archive content
@param PhingFile Zip file to list content
@return array List of files inside $zipfile | [
"List",
"archive",
"content"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/UnzipTask.php#L67-L80 | train |
phingofficial/phing | classes/phing/tasks/system/Relentless.php | Relentless.main | public function main()
{
$failCount = 0;
$taskNo = 0;
if (count($this->taskList) === 0) {
throw new BuildException('No tasks specified for <relentless>.');
}
$this->log('Relentlessly executing: ' . $this->getDescription());
foreach ($this->taskList as $t) {
$taskNo++;
$desc = $t->getDescription();
if ($desc === null) {
$desc = 'task ' . $taskNo;
}
if (!$this->terse) {
$this->log('Executing: ' . $desc);
}
try {
$t->perform();
} catch (BuildException $x) {
$this->log('Task ' . $desc . ' failed: ' . $x->getMessage());
$failCount++;
}
}
if ($failCount > 0) {
throw new BuildException(
'Relentless execution: ' . $failCount . ' of ' . count($this->taskList) . ' tasks failed.'
);
}
$this->log('All tasks completed successfully.');
} | php | public function main()
{
$failCount = 0;
$taskNo = 0;
if (count($this->taskList) === 0) {
throw new BuildException('No tasks specified for <relentless>.');
}
$this->log('Relentlessly executing: ' . $this->getDescription());
foreach ($this->taskList as $t) {
$taskNo++;
$desc = $t->getDescription();
if ($desc === null) {
$desc = 'task ' . $taskNo;
}
if (!$this->terse) {
$this->log('Executing: ' . $desc);
}
try {
$t->perform();
} catch (BuildException $x) {
$this->log('Task ' . $desc . ' failed: ' . $x->getMessage());
$failCount++;
}
}
if ($failCount > 0) {
throw new BuildException(
'Relentless execution: ' . $failCount . ' of ' . count($this->taskList) . ' tasks failed.'
);
}
$this->log('All tasks completed successfully.');
} | [
"public",
"function",
"main",
"(",
")",
"{",
"$",
"failCount",
"=",
"0",
";",
"$",
"taskNo",
"=",
"0",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"taskList",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"'No tasks specified... | This method will be called when it is time to execute the task.
@throws \BuildException | [
"This",
"method",
"will",
"be",
"called",
"when",
"it",
"is",
"time",
"to",
"execute",
"the",
"task",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/system/Relentless.php#L45-L76 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.getName | public function getName()
{
// that's a lastIndexOf
$index = ((($res = strrpos($this->path, self::$separator)) === false) ? -1 : $res);
if ($index < $this->prefixLength) {
return substr($this->path, $this->prefixLength);
}
return substr($this->path, $index + 1);
} | php | public function getName()
{
// that's a lastIndexOf
$index = ((($res = strrpos($this->path, self::$separator)) === false) ? -1 : $res);
if ($index < $this->prefixLength) {
return substr($this->path, $this->prefixLength);
}
return substr($this->path, $index + 1);
} | [
"public",
"function",
"getName",
"(",
")",
"{",
"// that's a lastIndexOf",
"$",
"index",
"=",
"(",
"(",
"(",
"$",
"res",
"=",
"strrpos",
"(",
"$",
"this",
"->",
"path",
",",
"self",
"::",
"$",
"separator",
")",
")",
"===",
"false",
")",
"?",
"-",
"... | Returns the name of the file or directory denoted by this abstract
pathname. This is just the last name in the pathname's name
sequence. If the pathname's name sequence is empty, then the empty
string is returned.
@return string The name of the file or directory denoted by this abstract
pathname, or the empty string if this pathname's name sequence
is empty | [
"Returns",
"the",
"name",
"of",
"the",
"file",
"or",
"directory",
"denoted",
"by",
"this",
"abstract",
"pathname",
".",
"This",
"is",
"just",
"the",
"last",
"name",
"in",
"the",
"pathname",
"s",
"name",
"sequence",
".",
"If",
"the",
"pathname",
"s",
"nam... | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L181-L190 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.getParent | public function getParent()
{
// that's a lastIndexOf
$index = ((($res = strrpos($this->path, self::$separator)) === false) ? -1 : $res);
if ($index < $this->prefixLength) {
if (($this->prefixLength > 0) && (strlen($this->path) > $this->prefixLength)) {
return substr($this->path, 0, $this->prefixLength);
}
return null;
}
return substr($this->path, 0, $index);
} | php | public function getParent()
{
// that's a lastIndexOf
$index = ((($res = strrpos($this->path, self::$separator)) === false) ? -1 : $res);
if ($index < $this->prefixLength) {
if (($this->prefixLength > 0) && (strlen($this->path) > $this->prefixLength)) {
return substr($this->path, 0, $this->prefixLength);
}
return null;
}
return substr($this->path, 0, $index);
} | [
"public",
"function",
"getParent",
"(",
")",
"{",
"// that's a lastIndexOf",
"$",
"index",
"=",
"(",
"(",
"(",
"$",
"res",
"=",
"strrpos",
"(",
"$",
"this",
"->",
"path",
",",
"self",
"::",
"$",
"separator",
")",
")",
"===",
"false",
")",
"?",
"-",
... | Returns the pathname string of this abstract pathname's parent, or
null if this pathname does not name a parent directory.
The parent of an abstract pathname consists of the pathname's prefix,
if any, and each name in the pathname's name sequence except for the last.
If the name sequence is empty then the pathname does not name a parent
directory.
@return string $pathname string of the parent directory named by this
abstract pathname, or null if this pathname does not name a parent | [
"Returns",
"the",
"pathname",
"string",
"of",
"this",
"abstract",
"pathname",
"s",
"parent",
"or",
"null",
"if",
"this",
"pathname",
"does",
"not",
"name",
"a",
"parent",
"directory",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L204-L217 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.getParentFile | public function getParentFile()
{
$p = $this->getParent();
if ($p === null) {
return null;
}
return new PhingFile((string) $p, (int) $this->prefixLength);
} | php | public function getParentFile()
{
$p = $this->getParent();
if ($p === null) {
return null;
}
return new PhingFile((string) $p, (int) $this->prefixLength);
} | [
"public",
"function",
"getParentFile",
"(",
")",
"{",
"$",
"p",
"=",
"$",
"this",
"->",
"getParent",
"(",
")",
";",
"if",
"(",
"$",
"p",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"PhingFile",
"(",
"(",
"string",
")",
"... | Returns the abstract pathname of this abstract pathname's parent,
or null if this pathname does not name a parent directory.
The parent of an abstract pathname consists of the pathname's prefix,
if any, and each name in the pathname's name sequence except for the
last. If the name sequence is empty then the pathname does not name
a parent directory.
@return PhingFile|null The abstract pathname of the parent directory named by this
abstract pathname, or null if this pathname
does not name a parent | [
"Returns",
"the",
"abstract",
"pathname",
"of",
"this",
"abstract",
"pathname",
"s",
"parent",
"or",
"null",
"if",
"this",
"pathname",
"does",
"not",
"name",
"a",
"parent",
"directory",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L232-L240 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.getPathWithoutBase | public function getPathWithoutBase($basedir)
{
if (!StringHelper::endsWith(self::$separator, $basedir)) {
$basedir .= self::$separator;
}
$path = $this->getPath();
if (substr($path, 0, strlen($basedir)) != $basedir) {
//path does not begin with basedir, we don't modify it
return $path;
}
return substr($path, strlen($basedir));
} | php | public function getPathWithoutBase($basedir)
{
if (!StringHelper::endsWith(self::$separator, $basedir)) {
$basedir .= self::$separator;
}
$path = $this->getPath();
if (substr($path, 0, strlen($basedir)) != $basedir) {
//path does not begin with basedir, we don't modify it
return $path;
}
return substr($path, strlen($basedir));
} | [
"public",
"function",
"getPathWithoutBase",
"(",
"$",
"basedir",
")",
"{",
"if",
"(",
"!",
"StringHelper",
"::",
"endsWith",
"(",
"self",
"::",
"$",
"separator",
",",
"$",
"basedir",
")",
")",
"{",
"$",
"basedir",
".=",
"self",
"::",
"$",
"separator",
... | Returns path without leading basedir.
@param string $basedir Base directory to strip
@return string Path without basedir
@uses getPath() | [
"Returns",
"path",
"without",
"leading",
"basedir",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L263-L275 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.canRead | public function canRead()
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this)) {
return (boolean) @is_link($this->getAbsolutePath()) || @is_readable($this->getAbsolutePath());
}
return false;
} | php | public function canRead()
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this)) {
return (boolean) @is_link($this->getAbsolutePath()) || @is_readable($this->getAbsolutePath());
}
return false;
} | [
"public",
"function",
"canRead",
"(",
")",
"{",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"if",
"(",
"$",
"fs",
"->",
"checkAccess",
"(",
"$",
"this",
")",
")",
"{",
"return",
"(",
"boolean",
")",
"@",
"is_link",
"(",
"$",... | Tests whether the application can read the file denoted by this
abstract pathname.
@return boolean true if and only if the file specified by this
abstract pathname exists and can be read by the
application; false otherwise | [
"Tests",
"whether",
"the",
"application",
"can",
"read",
"the",
"file",
"denoted",
"by",
"this",
"abstract",
"pathname",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L461-L470 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.exists | public function exists()
{
clearstatcache();
if (is_link($this->path)) {
return true;
} else {
if ($this->isDirectory()) {
return true;
} else {
return @file_exists($this->path) || is_link($this->path);
}
}
} | php | public function exists()
{
clearstatcache();
if (is_link($this->path)) {
return true;
} else {
if ($this->isDirectory()) {
return true;
} else {
return @file_exists($this->path) || is_link($this->path);
}
}
} | [
"public",
"function",
"exists",
"(",
")",
"{",
"clearstatcache",
"(",
")",
";",
"if",
"(",
"is_link",
"(",
"$",
"this",
"->",
"path",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"$",
"this",
"->",
"isDirectory",
"(",
")",
"... | Tests whether the file denoted by this abstract pathname exists.
@return boolean true if and only if the file denoted by this
abstract pathname exists; false otherwise | [
"Tests",
"whether",
"the",
"file",
"denoted",
"by",
"this",
"abstract",
"pathname",
"exists",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L494-L507 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.isDirectory | public function isDirectory()
{
clearstatcache();
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No read access to " . $this->path);
}
return @is_dir($this->path) && !@is_link($this->path);
} | php | public function isDirectory()
{
clearstatcache();
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No read access to " . $this->path);
}
return @is_dir($this->path) && !@is_link($this->path);
} | [
"public",
"function",
"isDirectory",
"(",
")",
"{",
"clearstatcache",
"(",
")",
";",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"if",
"(",
"$",
"fs",
"->",
"checkAccess",
"(",
"$",
"this",
")",
"!==",
"true",
")",
"{",
"throw... | Tests whether the file denoted by this abstract pathname is a
directory.
@throws IOException
@return boolean true if and only if the file denoted by this
abstract pathname exists and is a directory;
false otherwise | [
"Tests",
"whether",
"the",
"file",
"denoted",
"by",
"this",
"abstract",
"pathname",
"is",
"a",
"directory",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L518-L527 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.isLink | public function isLink()
{
clearstatcache();
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No read access to " . $this->path);
}
return @is_link($this->path);
} | php | public function isLink()
{
clearstatcache();
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No read access to " . $this->path);
}
return @is_link($this->path);
} | [
"public",
"function",
"isLink",
"(",
")",
"{",
"clearstatcache",
"(",
")",
";",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"if",
"(",
"$",
"fs",
"->",
"checkAccess",
"(",
"$",
"this",
")",
"!==",
"true",
")",
"{",
"throw",
... | Tests whether the file denoted by this abstract pathname is a symbolic link.
@throws IOException
@return boolean true if and only if the file denoted by this
abstract pathname exists and is a symbolic link;
false otherwise | [
"Tests",
"whether",
"the",
"file",
"denoted",
"by",
"this",
"abstract",
"pathname",
"is",
"a",
"symbolic",
"link",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L577-L586 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.isExecutable | public function isExecutable()
{
clearstatcache();
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No read access to " . $this->path);
}
return @is_executable($this->path);
} | php | public function isExecutable()
{
clearstatcache();
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No read access to " . $this->path);
}
return @is_executable($this->path);
} | [
"public",
"function",
"isExecutable",
"(",
")",
"{",
"clearstatcache",
"(",
")",
";",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"if",
"(",
"$",
"fs",
"->",
"checkAccess",
"(",
"$",
"this",
")",
"!==",
"true",
")",
"{",
"thro... | Tests whether the file denoted by this abstract pathname is executable.
@throws IOException
@return boolean true if and only if the file denoted by this
abstract pathname exists and is a symbolic link;
false otherwise | [
"Tests",
"whether",
"the",
"file",
"denoted",
"by",
"this",
"abstract",
"pathname",
"is",
"executable",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L596-L605 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.lastModified | public function lastModified()
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No read access to " . $this->path);
}
return $fs->getLastModifiedTime($this);
} | php | public function lastModified()
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No read access to " . $this->path);
}
return $fs->getLastModifiedTime($this);
} | [
"public",
"function",
"lastModified",
"(",
")",
"{",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"if",
"(",
"$",
"fs",
"->",
"checkAccess",
"(",
"$",
"this",
")",
"!==",
"true",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\... | Returns the time that the file denoted by this abstract pathname was
last modified.
@throws IOException
@return int An integer value representing the time the file was
last modified, measured in seconds since the epoch
(00:00:00 GMT, January 1, 1970), or 0 if the
file does not exist or if an I/O error occurs | [
"Returns",
"the",
"time",
"that",
"the",
"file",
"denoted",
"by",
"this",
"abstract",
"pathname",
"was",
"last",
"modified",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L627-L635 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.length | public function length()
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No read access to " . $this->path . "\n");
}
return $fs->getLength($this);
} | php | public function length()
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No read access to " . $this->path . "\n");
}
return $fs->getLength($this);
} | [
"public",
"function",
"length",
"(",
")",
"{",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"if",
"(",
"$",
"fs",
"->",
"checkAccess",
"(",
"$",
"this",
")",
"!==",
"true",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"No re... | Returns the length of the file denoted by this abstract pathname.
The return value is unspecified if this pathname denotes a directory.
@throws IOException
@return int The length, in bytes, of the file denoted by this abstract
pathname, or 0 if the file does not exist | [
"Returns",
"the",
"length",
"of",
"the",
"file",
"denoted",
"by",
"this",
"abstract",
"pathname",
".",
"The",
"return",
"value",
"is",
"unspecified",
"if",
"this",
"pathname",
"denotes",
"a",
"directory",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L645-L653 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.createNewFile | public function createNewFile($parents = true, $mode = 0777)
{
/**
* @var PhingFile $parent
*/
$parent = $this->getParentFile();
if ($parents && $parent !== null && !$parent->exists()) {
$parent->mkdirs();
}
$file = FileSystem::getFileSystem()->createNewFile($this->path);
return $file;
} | php | public function createNewFile($parents = true, $mode = 0777)
{
/**
* @var PhingFile $parent
*/
$parent = $this->getParentFile();
if ($parents && $parent !== null && !$parent->exists()) {
$parent->mkdirs();
}
$file = FileSystem::getFileSystem()->createNewFile($this->path);
return $file;
} | [
"public",
"function",
"createNewFile",
"(",
"$",
"parents",
"=",
"true",
",",
"$",
"mode",
"=",
"0777",
")",
"{",
"/**\n * @var PhingFile $parent\n */",
"$",
"parent",
"=",
"$",
"this",
"->",
"getParentFile",
"(",
")",
";",
"if",
"(",
"$",
"p... | Atomically creates a new, empty file named by this abstract pathname if
and only if a file with this name does not yet exist. The check for the
existence of the file and the creation of the file if it does not exist
are a single operation that is atomic with respect to all other
filesystem activities that might affect the file.
@param bool $parents
@param int $mode
@throws IOException
@return boolean true if the named file does not exist and was
successfully created; <code>false</code> if the named file
already exists | [
"Atomically",
"creates",
"a",
"new",
"empty",
"file",
"named",
"by",
"this",
"abstract",
"pathname",
"if",
"and",
"only",
"if",
"a",
"file",
"with",
"this",
"name",
"does",
"not",
"yet",
"exist",
".",
"The",
"check",
"for",
"the",
"existence",
"of",
"the... | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L687-L700 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.delete | public function delete($recursive = false)
{
$fs = FileSystem::getFileSystem();
if ($fs->canDelete($this) !== true) {
throw new IOException("Cannot delete " . $this->path . "\n");
}
$fs->delete($this, $recursive);
} | php | public function delete($recursive = false)
{
$fs = FileSystem::getFileSystem();
if ($fs->canDelete($this) !== true) {
throw new IOException("Cannot delete " . $this->path . "\n");
}
$fs->delete($this, $recursive);
} | [
"public",
"function",
"delete",
"(",
"$",
"recursive",
"=",
"false",
")",
"{",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"if",
"(",
"$",
"fs",
"->",
"canDelete",
"(",
"$",
"this",
")",
"!==",
"true",
")",
"{",
"throw",
"ne... | Deletes the file or directory denoted by this abstract pathname. If
this pathname denotes a directory, then the directory must be empty in
order to be deleted.
@param bool $recursive
@throws IOException | [
"Deletes",
"the",
"file",
"or",
"directory",
"denoted",
"by",
"this",
"abstract",
"pathname",
".",
"If",
"this",
"pathname",
"denotes",
"a",
"directory",
"then",
"the",
"directory",
"must",
"be",
"empty",
"in",
"order",
"to",
"be",
"deleted",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L710-L718 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.listDir | public function listDir(): ?array
{
try {
$elements = FileSystem::getFileSystem()->listContents($this);
} catch (IOException $e) {
$elements = null;
}
return $elements;
} | php | public function listDir(): ?array
{
try {
$elements = FileSystem::getFileSystem()->listContents($this);
} catch (IOException $e) {
$elements = null;
}
return $elements;
} | [
"public",
"function",
"listDir",
"(",
")",
":",
"?",
"array",
"{",
"try",
"{",
"$",
"elements",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
"->",
"listContents",
"(",
"$",
"this",
")",
";",
"}",
"catch",
"(",
"IOException",
"$",
"e",
")",
"{"... | Returns an array of strings naming the files and directories in the
directory denoted by this abstract pathname.
If this abstract pathname does not denote a directory, then this
method returns null Otherwise an array of strings is
returned, one for each file or directory in the directory. Names
denoting the directory itself and the directory's parent directory are
not included in the result. Each string is a file name rather than a
complete path.
There is no guarantee that the name strings in the resulting array
will appear in any specific order; they are not, in particular,
guaranteed to appear in alphabetical order.
@return array|null An array of strings naming the files and directories in the
directory denoted by this abstract pathname. The array will be
empty if the directory is empty. Returns null if
this abstract pathname does not denote a directory, or if an
I/O error occurs. | [
"Returns",
"an",
"array",
"of",
"strings",
"naming",
"the",
"files",
"and",
"directories",
"in",
"the",
"directory",
"denoted",
"by",
"this",
"abstract",
"pathname",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L756-L765 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.mkdirs | public function mkdirs($mode = 0755)
{
if ($this->exists()) {
return false;
}
try {
if ($this->mkdir($mode)) {
return true;
}
} catch (IOException $ioe) {
// IOException from mkdir() means that directory propbably didn't exist.
}
$parentFile = $this->getParentFile();
return (($parentFile !== null) && ($parentFile->mkdirs($mode) && $this->mkdir($mode)));
} | php | public function mkdirs($mode = 0755)
{
if ($this->exists()) {
return false;
}
try {
if ($this->mkdir($mode)) {
return true;
}
} catch (IOException $ioe) {
// IOException from mkdir() means that directory propbably didn't exist.
}
$parentFile = $this->getParentFile();
return (($parentFile !== null) && ($parentFile->mkdirs($mode) && $this->mkdir($mode)));
} | [
"public",
"function",
"mkdirs",
"(",
"$",
"mode",
"=",
"0755",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"mkdir",
"(",
"$",
"mode",
")",
")",
"... | Creates the directory named by this abstract pathname, including any
necessary but nonexistent parent directories. Note that if this
operation fails it may have succeeded in creating some of the necessary
parent directories.
@param int $mode
@throws IOException
@return boolean true if and only if the directory was created,
along with all necessary parent directories; false
otherwise | [
"Creates",
"the",
"directory",
"named",
"by",
"this",
"abstract",
"pathname",
"including",
"any",
"necessary",
"but",
"nonexistent",
"parent",
"directories",
".",
"Note",
"that",
"if",
"this",
"operation",
"fails",
"it",
"may",
"have",
"succeeded",
"in",
"creati... | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L779-L794 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.mkdir | public function mkdir($mode = 0755)
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess(new PhingFile($this->path), true) !== true) {
throw new IOException("No write access to " . $this->getPath());
}
return $fs->createDirectory($this, $mode);
} | php | public function mkdir($mode = 0755)
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess(new PhingFile($this->path), true) !== true) {
throw new IOException("No write access to " . $this->getPath());
}
return $fs->createDirectory($this, $mode);
} | [
"public",
"function",
"mkdir",
"(",
"$",
"mode",
"=",
"0755",
")",
"{",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"if",
"(",
"$",
"fs",
"->",
"checkAccess",
"(",
"new",
"PhingFile",
"(",
"$",
"this",
"->",
"path",
")",
","... | Creates the directory named by this abstract pathname.
@param int $mode
@throws IOException
@return boolean true if and only if the directory was created; false otherwise | [
"Creates",
"the",
"directory",
"named",
"by",
"this",
"abstract",
"pathname",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L803-L812 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.renameTo | public function renameTo(PhingFile $destFile)
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No write access to " . $this->getPath());
}
$fs->rename($this, $destFile);
} | php | public function renameTo(PhingFile $destFile)
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No write access to " . $this->getPath());
}
$fs->rename($this, $destFile);
} | [
"public",
"function",
"renameTo",
"(",
"PhingFile",
"$",
"destFile",
")",
"{",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"if",
"(",
"$",
"fs",
"->",
"checkAccess",
"(",
"$",
"this",
")",
"!==",
"true",
")",
"{",
"throw",
"ne... | Renames the file denoted by this abstract pathname.
@param PhingFile $destFile The new abstract pathname for the named file
@throws IOException | [
"Renames",
"the",
"file",
"denoted",
"by",
"this",
"abstract",
"pathname",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L820-L828 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.copyTo | public function copyTo(PhingFile $destFile)
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No read access to " . $this->getPath() . "\n");
}
if ($fs->checkAccess($destFile, true) !== true) {
throw new IOException("File::copyTo() No write access to " . $destFile->getPath());
}
$fs->copy($this, $destFile);
} | php | public function copyTo(PhingFile $destFile)
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this) !== true) {
throw new IOException("No read access to " . $this->getPath() . "\n");
}
if ($fs->checkAccess($destFile, true) !== true) {
throw new IOException("File::copyTo() No write access to " . $destFile->getPath());
}
$fs->copy($this, $destFile);
} | [
"public",
"function",
"copyTo",
"(",
"PhingFile",
"$",
"destFile",
")",
"{",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"if",
"(",
"$",
"fs",
"->",
"checkAccess",
"(",
"$",
"this",
")",
"!==",
"true",
")",
"{",
"throw",
"new"... | Simple-copies file denoted by this abstract pathname into another
PhingFile
@param PhingFile $destFile The new abstract pathname for the named file
@throws IOException | [
"Simple",
"-",
"copies",
"file",
"denoted",
"by",
"this",
"abstract",
"pathname",
"into",
"another",
"PhingFile"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L837-L850 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.setLastModified | public function setLastModified($time)
{
$time = (int) $time;
if ($time < 0) {
throw new Exception("IllegalArgumentException, Negative $time\n");
}
$fs = FileSystem::getFileSystem();
$fs->setLastModifiedTime($this, $time);
} | php | public function setLastModified($time)
{
$time = (int) $time;
if ($time < 0) {
throw new Exception("IllegalArgumentException, Negative $time\n");
}
$fs = FileSystem::getFileSystem();
$fs->setLastModifiedTime($this, $time);
} | [
"public",
"function",
"setLastModified",
"(",
"$",
"time",
")",
"{",
"$",
"time",
"=",
"(",
"int",
")",
"$",
"time",
";",
"if",
"(",
"$",
"time",
"<",
"0",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"IllegalArgumentException, Negative $time\\n\"",
")",
... | Sets the last-modified time of the file or directory named by this
abstract pathname.
All platforms support file-modification times to the nearest second,
but some provide more precision. The argument will be truncated to fit
the supported precision. If the operation succeeds and no intervening
operations on the file take place, then the next invocation of the
lastModified method will return the (possibly truncated) time argument
that was passed to this method.
@param int $time The new last-modified time, measured in milliseconds since
the epoch (00:00:00 GMT, January 1, 1970)
@throws Exception | [
"Sets",
"the",
"last",
"-",
"modified",
"time",
"of",
"the",
"file",
"or",
"directory",
"named",
"by",
"this",
"abstract",
"pathname",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L867-L877 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.setReadOnly | public function setReadOnly()
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this, true) !== true) {
// Error, no write access
throw new IOException("No write access to " . $this->getPath());
}
$fs->setReadOnly($this);
} | php | public function setReadOnly()
{
$fs = FileSystem::getFileSystem();
if ($fs->checkAccess($this, true) !== true) {
// Error, no write access
throw new IOException("No write access to " . $this->getPath());
}
$fs->setReadOnly($this);
} | [
"public",
"function",
"setReadOnly",
"(",
")",
"{",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"if",
"(",
"$",
"fs",
"->",
"checkAccess",
"(",
"$",
"this",
",",
"true",
")",
"!==",
"true",
")",
"{",
"// Error, no write access",
... | Marks the file or directory named by this abstract pathname so that
only read operations are allowed. After invoking this method the file
or directory is guaranteed not to change until it is either deleted or
marked to allow write access. Whether or not a read-only file or
directory may be deleted depends upon the underlying system.
@throws IOException | [
"Marks",
"the",
"file",
"or",
"directory",
"named",
"by",
"this",
"abstract",
"pathname",
"so",
"that",
"only",
"read",
"operations",
"are",
"allowed",
".",
"After",
"invoking",
"this",
"method",
"the",
"file",
"or",
"directory",
"is",
"guaranteed",
"not",
"... | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L888-L897 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.setUser | public function setUser($user)
{
$fs = FileSystem::getFileSystem();
$fs->chown($this->getPath(), $user);
} | php | public function setUser($user)
{
$fs = FileSystem::getFileSystem();
$fs->chown($this->getPath(), $user);
} | [
"public",
"function",
"setUser",
"(",
"$",
"user",
")",
"{",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"$",
"fs",
"->",
"chown",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
",",
"$",
"user",
")",
";",
"}"
] | Sets the owner of the file.
@param mixed $user User name or number.
@throws IOException | [
"Sets",
"the",
"owner",
"of",
"the",
"file",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L906-L911 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.setGroup | public function setGroup($group)
{
$fs = FileSystem::getFileSystem();
$fs->chgrp($this->getPath(), $group);
} | php | public function setGroup($group)
{
$fs = FileSystem::getFileSystem();
$fs->chgrp($this->getPath(), $group);
} | [
"public",
"function",
"setGroup",
"(",
"$",
"group",
")",
"{",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"$",
"fs",
"->",
"chgrp",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
",",
"$",
"group",
")",
";",
"}"
] | Sets the group of the file.
@param string $group
@throws IOException | [
"Sets",
"the",
"group",
"of",
"the",
"file",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L930-L935 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.setMode | public function setMode($mode)
{
$fs = FileSystem::getFileSystem();
$fs->chmod($this->getPath(), $mode);
} | php | public function setMode($mode)
{
$fs = FileSystem::getFileSystem();
$fs->chmod($this->getPath(), $mode);
} | [
"public",
"function",
"setMode",
"(",
"$",
"mode",
")",
"{",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"$",
"fs",
"->",
"chmod",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
",",
"$",
"mode",
")",
";",
"}"
] | Sets the mode of the file
@param int $mode Octal mode.
@throws IOException | [
"Sets",
"the",
"mode",
"of",
"the",
"file"
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L953-L958 | train |
phingofficial/phing | classes/phing/system/io/PhingFile.php | PhingFile.compareTo | public function compareTo(PhingFile $file)
{
$fs = FileSystem::getFileSystem();
return $fs->compare($this, $file);
} | php | public function compareTo(PhingFile $file)
{
$fs = FileSystem::getFileSystem();
return $fs->compare($this, $file);
} | [
"public",
"function",
"compareTo",
"(",
"PhingFile",
"$",
"file",
")",
"{",
"$",
"fs",
"=",
"FileSystem",
"::",
"getFileSystem",
"(",
")",
";",
"return",
"$",
"fs",
"->",
"compare",
"(",
"$",
"this",
",",
"$",
"file",
")",
";",
"}"
] | Compares two abstract pathnames lexicographically. The ordering
defined by this method depends upon the underlying system. On UNIX
systems, alphabetic case is significant in comparing pathnames; on Win32
systems it is not.
@param PhingFile $file Th file whose pathname sould be compared to the pathname of this file.
@return int Zero if the argument is equal to this abstract pathname, a
value less than zero if this abstract pathname is
lexicographically less than the argument, or a value greater
than zero if this abstract pathname is lexicographically
greater than the argument | [
"Compares",
"two",
"abstract",
"pathnames",
"lexicographically",
".",
"The",
"ordering",
"defined",
"by",
"this",
"method",
"depends",
"upon",
"the",
"underlying",
"system",
".",
"On",
"UNIX",
"systems",
"alphabetic",
"case",
"is",
"significant",
"in",
"comparing"... | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/system/io/PhingFile.php#L1083-L1088 | train |
phingofficial/phing | classes/phing/tasks/ext/phpunit/JUnit.php | JUnit.flush | public function flush(): void
{
if ($this->writeDocument === true) {
$this->write($this->getXML());
}
parent::flush();
} | php | public function flush(): void
{
if ($this->writeDocument === true) {
$this->write($this->getXML());
}
parent::flush();
} | [
"public",
"function",
"flush",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"writeDocument",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"write",
"(",
"$",
"this",
"->",
"getXML",
"(",
")",
")",
";",
"}",
"parent",
"::",
"flush",
"("... | Flush buffer and close output. | [
"Flush",
"buffer",
"and",
"close",
"output",
"."
] | 4b1797694dc65505af496ca2e1a3470efb9e35e1 | https://github.com/phingofficial/phing/blob/4b1797694dc65505af496ca2e1a3470efb9e35e1/classes/phing/tasks/ext/phpunit/JUnit.php#L131-L138 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.