id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
45,400
TwistoPayments/Twisto.php
src/Twisto/Invoice.php
Invoice.create
public static function create(Twisto $twisto, $transaction_id, $eshop_invoice_id = null) { $data = array( 'transaction_id' => $transaction_id ); if ($eshop_invoice_id !== null) { $data['eshop_invoice_id'] = $eshop_invoice_id; } $data = $twisto->requestJson('POST', 'invoice/', $data); $invoice = new Invoice($twisto, null); $invoice->deserialize($data); return $invoice; }
php
public static function create(Twisto $twisto, $transaction_id, $eshop_invoice_id = null) { $data = array( 'transaction_id' => $transaction_id ); if ($eshop_invoice_id !== null) { $data['eshop_invoice_id'] = $eshop_invoice_id; } $data = $twisto->requestJson('POST', 'invoice/', $data); $invoice = new Invoice($twisto, null); $invoice->deserialize($data); return $invoice; }
[ "public", "static", "function", "create", "(", "Twisto", "$", "twisto", ",", "$", "transaction_id", ",", "$", "eshop_invoice_id", "=", "null", ")", "{", "$", "data", "=", "array", "(", "'transaction_id'", "=>", "$", "transaction_id", ")", ";", "if", "(", ...
Create new invoice using transaction_id from check @param Twisto $twisto @param string $transaction_id @param string $eshop_invoice_id @return Invoice
[ "Create", "new", "invoice", "using", "transaction_id", "from", "check" ]
89a9361830766205ce9141bfde88515043600161
https://github.com/TwistoPayments/Twisto.php/blob/89a9361830766205ce9141bfde88515043600161/src/Twisto/Invoice.php#L109-L123
45,401
TwistoPayments/Twisto.php
src/Twisto/Invoice.php
Invoice.returnItems
public function returnItems($items, $discounts = null) { $data = array( 'items' => array_map(function(ItemReturn $item) { return $item->serialize(); }, $items) ); if ($discounts !== null) { $data['discounts'] = array_map(function(ItemDiscountReturn $item) { return $item->serialize(); }, $discounts); } $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/return/', $data); $this->deserialize($data); }
php
public function returnItems($items, $discounts = null) { $data = array( 'items' => array_map(function(ItemReturn $item) { return $item->serialize(); }, $items) ); if ($discounts !== null) { $data['discounts'] = array_map(function(ItemDiscountReturn $item) { return $item->serialize(); }, $discounts); } $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/return/', $data); $this->deserialize($data); }
[ "public", "function", "returnItems", "(", "$", "items", ",", "$", "discounts", "=", "null", ")", "{", "$", "data", "=", "array", "(", "'items'", "=>", "array_map", "(", "function", "(", "ItemReturn", "$", "item", ")", "{", "return", "$", "item", "->", ...
Perform invoice return API request @param ItemReturn[] $items @param ItemDiscountReturn[] $discounts
[ "Perform", "invoice", "return", "API", "request" ]
89a9361830766205ce9141bfde88515043600161
https://github.com/TwistoPayments/Twisto.php/blob/89a9361830766205ce9141bfde88515043600161/src/Twisto/Invoice.php#L131-L147
45,402
TwistoPayments/Twisto.php
src/Twisto/Invoice.php
Invoice.returnAll
public function returnAll() { $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/return/all/'); $this->deserialize($data); }
php
public function returnAll() { $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/return/all/'); $this->deserialize($data); }
[ "public", "function", "returnAll", "(", ")", "{", "$", "data", "=", "$", "this", "->", "twisto", "->", "requestJson", "(", "'POST'", ",", "'invoice/'", ".", "urlencode", "(", "$", "this", "->", "invoice_id", ")", ".", "'/return/all/'", ")", ";", "$", "...
Perform invoice return all API request
[ "Perform", "invoice", "return", "all", "API", "request" ]
89a9361830766205ce9141bfde88515043600161
https://github.com/TwistoPayments/Twisto.php/blob/89a9361830766205ce9141bfde88515043600161/src/Twisto/Invoice.php#L152-L156
45,403
TwistoPayments/Twisto.php
src/Twisto/Invoice.php
Invoice.refund
public function refund($amount) { $data = array( 'amount' => (float)$amount ); $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/refund/', $data); $this->deserialize($data); }
php
public function refund($amount) { $data = array( 'amount' => (float)$amount ); $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/refund/', $data); $this->deserialize($data); }
[ "public", "function", "refund", "(", "$", "amount", ")", "{", "$", "data", "=", "array", "(", "'amount'", "=>", "(", "float", ")", "$", "amount", ")", ";", "$", "data", "=", "$", "this", "->", "twisto", "->", "requestJson", "(", "'POST'", ",", "'in...
Refunds specified amount from the invoice @param float amount to refund
[ "Refunds", "specified", "amount", "from", "the", "invoice" ]
89a9361830766205ce9141bfde88515043600161
https://github.com/TwistoPayments/Twisto.php/blob/89a9361830766205ce9141bfde88515043600161/src/Twisto/Invoice.php#L162-L169
45,404
TwistoPayments/Twisto.php
src/Twisto/Invoice.php
Invoice.splitItems
public function splitItems($items) { $data = array( 'items' => array_map(function(ItemSplit $item) { return $item->serialize(); }, $items) ); $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/split/', $data); $split_invoice = new Invoice($this->twisto, null); $split_invoice->deserialize($data); $this->get(); return $split_invoice; }
php
public function splitItems($items) { $data = array( 'items' => array_map(function(ItemSplit $item) { return $item->serialize(); }, $items) ); $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/split/', $data); $split_invoice = new Invoice($this->twisto, null); $split_invoice->deserialize($data); $this->get(); return $split_invoice; }
[ "public", "function", "splitItems", "(", "$", "items", ")", "{", "$", "data", "=", "array", "(", "'items'", "=>", "array_map", "(", "function", "(", "ItemSplit", "$", "item", ")", "{", "return", "$", "item", "->", "serialize", "(", ")", ";", "}", ","...
Split invoice to new one @param ItemSplit[] $items @return JSON response with new invoice
[ "Split", "invoice", "to", "new", "one" ]
89a9361830766205ce9141bfde88515043600161
https://github.com/TwistoPayments/Twisto.php/blob/89a9361830766205ce9141bfde88515043600161/src/Twisto/Invoice.php#L176-L190
45,405
Smart-Core/AcceleratorCacheBundle
CacheClearerService.php
CacheClearerService.createTemporaryFile
private function createTemporaryFile($user, $opcode) { if (!is_dir($this->webDir)) { throw new \InvalidArgumentException(sprintf('Web dir does not exist "%s"', $this->webDir)); } if (!is_writable($this->webDir)) { throw new \InvalidArgumentException(sprintf('Web dir is not writable "%s"', $this->webDir)); } $filename = sprintf('%s/%s', $this->webDir, 'apc-'.md5(uniqid().mt_rand(0, 9999999).php_uname()).'.php'); $contents = strtr($this->template, array( '%clearer_code%' => file_get_contents(__DIR__.'/AcceleratorCacheClearer.php'), '%user%' => var_export($user, true), '%opcode%' => var_export($opcode, true), )); if (false === $handle = fopen($filename, 'w+')) { throw new \RuntimeException(sprintf('Can\'t open "%s"', $filename)); } fwrite($handle, $contents); fclose($handle); return $filename; }
php
private function createTemporaryFile($user, $opcode) { if (!is_dir($this->webDir)) { throw new \InvalidArgumentException(sprintf('Web dir does not exist "%s"', $this->webDir)); } if (!is_writable($this->webDir)) { throw new \InvalidArgumentException(sprintf('Web dir is not writable "%s"', $this->webDir)); } $filename = sprintf('%s/%s', $this->webDir, 'apc-'.md5(uniqid().mt_rand(0, 9999999).php_uname()).'.php'); $contents = strtr($this->template, array( '%clearer_code%' => file_get_contents(__DIR__.'/AcceleratorCacheClearer.php'), '%user%' => var_export($user, true), '%opcode%' => var_export($opcode, true), )); if (false === $handle = fopen($filename, 'w+')) { throw new \RuntimeException(sprintf('Can\'t open "%s"', $filename)); } fwrite($handle, $contents); fclose($handle); return $filename; }
[ "private", "function", "createTemporaryFile", "(", "$", "user", ",", "$", "opcode", ")", "{", "if", "(", "!", "is_dir", "(", "$", "this", "->", "webDir", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Web dir does n...
Create the temporary file and return the filename. @param bool $user @param bool $opcode @return string
[ "Create", "the", "temporary", "file", "and", "return", "the", "filename", "." ]
c0d67ebe438572f9f4dd42287ade11741722fe30
https://github.com/Smart-Core/AcceleratorCacheBundle/blob/c0d67ebe438572f9f4dd42287ade11741722fe30/CacheClearerService.php#L156-L181
45,406
thephpleague/factory-muffin-faker
src/Faker.php
Faker.getGenerator
public function getGenerator() { if (!$this->generator) { $this->generator = Factory::create($this->locale); } return $this->generator; }
php
public function getGenerator() { if (!$this->generator) { $this->generator = Factory::create($this->locale); } return $this->generator; }
[ "public", "function", "getGenerator", "(", ")", "{", "if", "(", "!", "$", "this", "->", "generator", ")", "{", "$", "this", "->", "generator", "=", "Factory", "::", "create", "(", "$", "this", "->", "locale", ")", ";", "}", "return", "$", "this", "...
Get the generator instance. @return \Faker\Generator
[ "Get", "the", "generator", "instance", "." ]
eea89951bd990fa9c51dadc7e96a1e7bad026ddf
https://github.com/thephpleague/factory-muffin-faker/blob/eea89951bd990fa9c51dadc7e96a1e7bad026ddf/src/Faker.php#L75-L82
45,407
thephpleague/factory-muffin-faker
src/Faker.php
Faker.format
public function format($formatter, array $arguments = []) { $generator = $this->getGenerator(); return function () use ($generator, $formatter, $arguments) { return $generator->format($formatter, $arguments); }; }
php
public function format($formatter, array $arguments = []) { $generator = $this->getGenerator(); return function () use ($generator, $formatter, $arguments) { return $generator->format($formatter, $arguments); }; }
[ "public", "function", "format", "(", "$", "formatter", ",", "array", "$", "arguments", "=", "[", "]", ")", "{", "$", "generator", "=", "$", "this", "->", "getGenerator", "(", ")", ";", "return", "function", "(", ")", "use", "(", "$", "generator", ","...
Wrap a faker format in a closure. @param string $formatter The formatter. @param array $arguments The arguments. @return \Closure
[ "Wrap", "a", "faker", "format", "in", "a", "closure", "." ]
eea89951bd990fa9c51dadc7e96a1e7bad026ddf
https://github.com/thephpleague/factory-muffin-faker/blob/eea89951bd990fa9c51dadc7e96a1e7bad026ddf/src/Faker.php#L116-L123
45,408
Rias500/craft-position-fieldtype
src/fields/Position.php
Position.getOptions
private static function getOptions() { return [ 'left' => Craft::t('position-fieldtype', 'Left'), 'center' => Craft::t('position-fieldtype', 'Center'), 'right' => Craft::t('position-fieldtype', 'Right'), 'full' => Craft::t('position-fieldtype', 'Full'), 'drop-left' => Craft::t('position-fieldtype', 'Drop-left'), 'drop-right' => Craft::t('position-fieldtype', 'Drop-right'), ]; }
php
private static function getOptions() { return [ 'left' => Craft::t('position-fieldtype', 'Left'), 'center' => Craft::t('position-fieldtype', 'Center'), 'right' => Craft::t('position-fieldtype', 'Right'), 'full' => Craft::t('position-fieldtype', 'Full'), 'drop-left' => Craft::t('position-fieldtype', 'Drop-left'), 'drop-right' => Craft::t('position-fieldtype', 'Drop-right'), ]; }
[ "private", "static", "function", "getOptions", "(", ")", "{", "return", "[", "'left'", "=>", "Craft", "::", "t", "(", "'position-fieldtype'", ",", "'Left'", ")", ",", "'center'", "=>", "Craft", "::", "t", "(", "'position-fieldtype'", ",", "'Center'", ")", ...
Returns the position options. @return array
[ "Returns", "the", "position", "options", "." ]
18fc333880c34fd13ec2b04f43ad0a9a8b090ce2
https://github.com/Rias500/craft-position-fieldtype/blob/18fc333880c34fd13ec2b04f43ad0a9a8b090ce2/src/fields/Position.php#L234-L244
45,409
hiqdev/yii2-hiart
src/rest/QueryBuilder.php
QueryBuilder.buildAuth
public function buildAuth(Query $query) { $auth = $this->db->getAuth(); if (isset($auth['headerToken'])) { $this->authHeaders['Authorization'] = 'token ' . $auth['headerToken']; } if (isset($auth['headerBearer'])) { $this->authHeaders['Authorization'] = 'Bearer ' . $auth['headerBearer']; } }
php
public function buildAuth(Query $query) { $auth = $this->db->getAuth(); if (isset($auth['headerToken'])) { $this->authHeaders['Authorization'] = 'token ' . $auth['headerToken']; } if (isset($auth['headerBearer'])) { $this->authHeaders['Authorization'] = 'Bearer ' . $auth['headerBearer']; } }
[ "public", "function", "buildAuth", "(", "Query", "$", "query", ")", "{", "$", "auth", "=", "$", "this", "->", "db", "->", "getAuth", "(", ")", ";", "if", "(", "isset", "(", "$", "auth", "[", "'headerToken'", "]", ")", ")", "{", "$", "this", "->",...
This function is for you to provide your authentication. @param Query $query
[ "This", "function", "is", "for", "you", "to", "provide", "your", "authentication", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/rest/QueryBuilder.php#L23-L32
45,410
hiqdev/yii2-hiart
src/rest/Connection.php
Connection.getResponseError
public function getResponseError(ResponseInterface $response) { $code = $response->getStatusCode(); if ($code >= 200 && $code < 300) { return false; } return $response->getReasonPhrase(); }
php
public function getResponseError(ResponseInterface $response) { $code = $response->getStatusCode(); if ($code >= 200 && $code < 300) { return false; } return $response->getReasonPhrase(); }
[ "public", "function", "getResponseError", "(", "ResponseInterface", "$", "response", ")", "{", "$", "code", "=", "$", "response", "->", "getStatusCode", "(", ")", ";", "if", "(", "$", "code", ">=", "200", "&&", "$", "code", "<", "300", ")", "{", "retur...
Method checks whether the response is an error. @param ResponseInterface $response @return false|string the error text or boolean `false`, when the response is not an error
[ "Method", "checks", "whether", "the", "response", "is", "an", "error", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/rest/Connection.php#L25-L33
45,411
hiqdev/yii2-hiart
src/Command.php
Command.update
public function update($table, $columns, $condition = [], array $params = []) { $request = $this->db->getQueryBuilder()->update($table, $columns, $condition, $params); return $this->setRequest($request); }
php
public function update($table, $columns, $condition = [], array $params = []) { $request = $this->db->getQueryBuilder()->update($table, $columns, $condition, $params); return $this->setRequest($request); }
[ "public", "function", "update", "(", "$", "table", ",", "$", "columns", ",", "$", "condition", "=", "[", "]", ",", "array", "$", "params", "=", "[", "]", ")", "{", "$", "request", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "...
Sends a request to update data. @param mixed $table entity to update @param mixed $columns attributes of object to update @param array $condition @param array $params request parameters @return $this
[ "Sends", "a", "request", "to", "update", "data", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/Command.php#L73-L78
45,412
hiqdev/yii2-hiart
src/Command.php
Command.delete
public function delete($table, $condition, array $params = []) { $request = $this->db->getQueryBuilder()->delete($table, $condition, $params); return $this->setRequest($request); }
php
public function delete($table, $condition, array $params = []) { $request = $this->db->getQueryBuilder()->delete($table, $condition, $params); return $this->setRequest($request); }
[ "public", "function", "delete", "(", "$", "table", ",", "$", "condition", ",", "array", "$", "params", "=", "[", "]", ")", "{", "$", "request", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "delete", "(", "$", "table", ",",...
Sends a request to delete data. @param mixed $table entity to update @param array $condition @param array $params request parameters @return $this
[ "Sends", "a", "request", "to", "delete", "data", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/Command.php#L87-L92
45,413
hiqdev/yii2-hiart
src/Command.php
Command.perform
public function perform($action, $table, $body = [], array $params = []) { $request = $this->db->getQueryBuilder()->perform($action, $table, $body, $params); $this->setRequest($request); return $this->send(); }
php
public function perform($action, $table, $body = [], array $params = []) { $request = $this->db->getQueryBuilder()->perform($action, $table, $body, $params); $this->setRequest($request); return $this->send(); }
[ "public", "function", "perform", "(", "$", "action", ",", "$", "table", ",", "$", "body", "=", "[", "]", ",", "array", "$", "params", "=", "[", "]", ")", "{", "$", "request", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", ...
Creates and executes request with given data. @param string $action @param string $table @param mixed $body @param array $params request parameters @return ResponseInterface response object
[ "Creates", "and", "executes", "request", "with", "given", "data", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/Command.php#L102-L108
45,414
hiqdev/yii2-hiart
src/ActiveQuery.php
ActiveQuery.prepare
public function prepare($builder = null) { // NOTE: because the same ActiveQuery may be used to build different SQL statements // (e.g. by ActiveDataProvider, one for count query, the other for row data query, // it is important to make sure the same ActiveQuery can be used to build SQL statements // multiple times. if (!empty($this->joinWith)) { $this->buildJoinWith(); $this->joinWith = null; } return $this; }
php
public function prepare($builder = null) { // NOTE: because the same ActiveQuery may be used to build different SQL statements // (e.g. by ActiveDataProvider, one for count query, the other for row data query, // it is important to make sure the same ActiveQuery can be used to build SQL statements // multiple times. if (!empty($this->joinWith)) { $this->buildJoinWith(); $this->joinWith = null; } return $this; }
[ "public", "function", "prepare", "(", "$", "builder", "=", "null", ")", "{", "// NOTE: because the same ActiveQuery may be used to build different SQL statements", "// (e.g. by ActiveDataProvider, one for count query, the other for row data query,", "// it is important to make sure the same ...
Prepares query for use. See NOTE. @param QueryBuilder $builder @return static
[ "Prepares", "query", "for", "use", ".", "See", "NOTE", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/ActiveQuery.php#L104-L116
45,415
hiqdev/yii2-hiart
src/ActiveQuery.php
ActiveQuery.joinWithRelation
private function joinWithRelation($parent, $child) { if (!empty($child->join)) { foreach ($child->join as $join) { $this->join[] = $join; } } }
php
private function joinWithRelation($parent, $child) { if (!empty($child->join)) { foreach ($child->join as $join) { $this->join[] = $join; } } }
[ "private", "function", "joinWithRelation", "(", "$", "parent", ",", "$", "child", ")", "{", "if", "(", "!", "empty", "(", "$", "child", "->", "join", ")", ")", "{", "foreach", "(", "$", "child", "->", "join", "as", "$", "join", ")", "{", "$", "th...
Joins a parent query with a child query. The current query object will be modified accordingly. @param ActiveQuery $parent @param ActiveQuery $child
[ "Joins", "a", "parent", "query", "with", "a", "child", "query", ".", "The", "current", "query", "object", "will", "be", "modified", "accordingly", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/ActiveQuery.php#L203-L210
45,416
hiqdev/yii2-hiart
src/ActiveQuery.php
ActiveQuery.all
public function all($db = null) { if ($this->asArray) { return parent::all($db); } $rows = $this->searchAll($db); return $this->populate($rows); }
php
public function all($db = null) { if ($this->asArray) { return parent::all($db); } $rows = $this->searchAll($db); return $this->populate($rows); }
[ "public", "function", "all", "(", "$", "db", "=", "null", ")", "{", "if", "(", "$", "this", "->", "asArray", ")", "{", "return", "parent", "::", "all", "(", "$", "db", ")", ";", "}", "$", "rows", "=", "$", "this", "->", "searchAll", "(", "$", ...
Executes query and returns all results as an array. @param AbstractConnection $db the DB connection used to create the DB command. If null, the DB connection returned by [[modelClass]] will be used. @return array|ActiveRecord[] the query results. If the query results in nothing, an empty array will be returned.
[ "Executes", "query", "and", "returns", "all", "results", "as", "an", "array", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/ActiveQuery.php#L268-L277
45,417
hiqdev/yii2-hiart
src/stream/Request.php
Request.convertContextOptions
protected function convertContextOptions(array $options) { $contextOptions = []; foreach ($options as $key => $value) { $section = 'http'; if (strpos($key, 'ssl') === 0) { $section = 'ssl'; $key = substr($key, 3); } $key = Inflector::underscore($key); $contextOptions[$section][$key] = $value; } return $contextOptions; }
php
protected function convertContextOptions(array $options) { $contextOptions = []; foreach ($options as $key => $value) { $section = 'http'; if (strpos($key, 'ssl') === 0) { $section = 'ssl'; $key = substr($key, 3); } $key = Inflector::underscore($key); $contextOptions[$section][$key] = $value; } return $contextOptions; }
[ "protected", "function", "convertContextOptions", "(", "array", "$", "options", ")", "{", "$", "contextOptions", "=", "[", "]", ";", "foreach", "(", "$", "options", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "section", "=", "'http'", ";", "if...
Composes stream context options from raw options. @param array $options raw options @return array stream context options
[ "Composes", "stream", "context", "options", "from", "raw", "options", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/stream/Request.php#L83-L97
45,418
hiqdev/yii2-hiart
src/ActiveRecord.php
ActiveRecord.attributes
public function attributes() { $attributes = []; foreach ($this->rules() as $rule) { $names = reset($rule); if (is_string($names)) { $names = [$names]; } foreach ($names as $name) { if (substr_compare($name, '!', 0, 1) === 0) { $name = mb_substr($name, 1); } $attributes[$name] = $name; } } return array_values($attributes); }
php
public function attributes() { $attributes = []; foreach ($this->rules() as $rule) { $names = reset($rule); if (is_string($names)) { $names = [$names]; } foreach ($names as $name) { if (substr_compare($name, '!', 0, 1) === 0) { $name = mb_substr($name, 1); } $attributes[$name] = $name; } } return array_values($attributes); }
[ "public", "function", "attributes", "(", ")", "{", "$", "attributes", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "rules", "(", ")", "as", "$", "rule", ")", "{", "$", "names", "=", "reset", "(", "$", "rule", ")", ";", "if", "(", "is_...
Returns the list of attribute names. By default, this method returns all attributes mentioned in rules. You may override this method to change the default behavior. @return string[] list of attribute names
[ "Returns", "the", "list", "of", "attribute", "names", ".", "By", "default", "this", "method", "returns", "all", "attributes", "mentioned", "in", "rules", ".", "You", "may", "override", "this", "method", "to", "change", "the", "default", "behavior", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/ActiveRecord.php#L75-L92
45,419
hiqdev/yii2-hiart
src/ActiveRecord.php
ActiveRecord.query
public function query($defaultScenario, $data = [], array $options = []) { $action = $this->getScenarioAction($defaultScenario); return static::perform($action, $data, $options); }
php
public function query($defaultScenario, $data = [], array $options = []) { $action = $this->getScenarioAction($defaultScenario); return static::perform($action, $data, $options); }
[ "public", "function", "query", "(", "$", "defaultScenario", ",", "$", "data", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "action", "=", "$", "this", "->", "getScenarioAction", "(", "$", "defaultScenario", ")", ";", "re...
Perform query. @param string $defaultScenario @param array $data data @param array $options @return array result
[ "Perform", "query", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/ActiveRecord.php#L245-L250
45,420
hiqdev/yii2-hiart
src/ActiveRecord.php
ActiveRecord.getScenarioAction
public function getScenarioAction($default = '') { if ($this->isScenarioDefault()) { if (empty($default)) { throw new InvalidConfigException('Scenario not specified'); } return $default; } else { $actions = static::scenarioActions(); return isset($actions[$this->scenario]) ? $actions[$this->scenario] : $this->scenario; } }
php
public function getScenarioAction($default = '') { if ($this->isScenarioDefault()) { if (empty($default)) { throw new InvalidConfigException('Scenario not specified'); } return $default; } else { $actions = static::scenarioActions(); return isset($actions[$this->scenario]) ? $actions[$this->scenario] : $this->scenario; } }
[ "public", "function", "getScenarioAction", "(", "$", "default", "=", "''", ")", "{", "if", "(", "$", "this", "->", "isScenarioDefault", "(", ")", ")", "{", "if", "(", "empty", "(", "$", "default", ")", ")", "{", "throw", "new", "InvalidConfigException", ...
Converts scenario name to action. @param string $default default action name @throws InvalidConfigException @throws NotSupportedException @return string
[ "Converts", "scenario", "name", "to", "action", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/ActiveRecord.php#L271-L284
45,421
hiqdev/yii2-hiart
src/Collection.php
Collection.setModel
public function setModel($model) { if ($model instanceof Model) { $this->model = $model; } else { $this->model = Yii::createObject($model); } $model = $this->model; $this->updateFormName(); if (empty($this->getScenario())) { $this->setScenario($model->scenario); } return $this->model; }
php
public function setModel($model) { if ($model instanceof Model) { $this->model = $model; } else { $this->model = Yii::createObject($model); } $model = $this->model; $this->updateFormName(); if (empty($this->getScenario())) { $this->setScenario($model->scenario); } return $this->model; }
[ "public", "function", "setModel", "(", "$", "model", ")", "{", "if", "(", "$", "model", "instanceof", "Model", ")", "{", "$", "this", "->", "model", "=", "$", "model", ";", "}", "else", "{", "$", "this", "->", "model", "=", "Yii", "::", "createObje...
Sets the model of the collection. @param ActiveRecord|array $model if the model is an instance of [[Model]] - sets it, otherwise - creates the model using given options array @return object|ActiveRecord
[ "Sets", "the", "model", "of", "the", "collection", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/Collection.php#L130-L146
45,422
hiqdev/yii2-hiart
src/Collection.php
Collection.set
public function set($models) { if ($models instanceof ActiveRecord) { $models = [$models]; } $first = reset($models); if ($first === false) { return $this; } $this->first = $first; $this->formName = $first->formName(); $this->model = $this->setModel($first); $this->models = $models; if ($this->checkConsistency && !$this->isConsistent()) { throw new InvalidValueException('Models are not objects of same class or not follow same operation'); } return $this; }
php
public function set($models) { if ($models instanceof ActiveRecord) { $models = [$models]; } $first = reset($models); if ($first === false) { return $this; } $this->first = $first; $this->formName = $first->formName(); $this->model = $this->setModel($first); $this->models = $models; if ($this->checkConsistency && !$this->isConsistent()) { throw new InvalidValueException('Models are not objects of same class or not follow same operation'); } return $this; }
[ "public", "function", "set", "(", "$", "models", ")", "{", "if", "(", "$", "models", "instanceof", "ActiveRecord", ")", "{", "$", "models", "=", "[", "$", "models", "]", ";", "}", "$", "first", "=", "reset", "(", "$", "models", ")", ";", "if", "(...
Sets the array of AR models to the collection. @param array|ActiveRecord $models - array of AR Models or a single model @return $this
[ "Sets", "the", "array", "of", "AR", "models", "to", "the", "collection", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/Collection.php#L290-L311
45,423
hiqdev/yii2-hiart
src/Collection.php
Collection.collectData
public function collectData($attributes = null) { $data = []; foreach ($this->models as $model) { if ($this->dataCollector instanceof Closure) { list($key, $row) = call_user_func($this->dataCollector, $model, $this); } else { $key = $model->getPrimaryKey(); $row = $model->getAttributes($attributes); } if ($key) { $data[$key] = $row; } else { $data[] = $row; } } return $data; }
php
public function collectData($attributes = null) { $data = []; foreach ($this->models as $model) { if ($this->dataCollector instanceof Closure) { list($key, $row) = call_user_func($this->dataCollector, $model, $this); } else { $key = $model->getPrimaryKey(); $row = $model->getAttributes($attributes); } if ($key) { $data[$key] = $row; } else { $data[] = $row; } } return $data; }
[ "public", "function", "collectData", "(", "$", "attributes", "=", "null", ")", "{", "$", "data", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "models", "as", "$", "model", ")", "{", "if", "(", "$", "this", "->", "dataCollector", "instanceof...
Collects data from the stored models. @param string|array $attributes list of attributes names @return array
[ "Collects", "data", "from", "the", "stored", "models", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/Collection.php#L441-L460
45,424
hiqdev/yii2-hiart
src/Collection.php
Collection.getFirstError
public function getFirstError() { foreach ($this->models as $model) { if ($model->hasErrors()) { $errors = $model->getFirstErrors(); return array_shift($errors); } } return false; }
php
public function getFirstError() { foreach ($this->models as $model) { if ($model->hasErrors()) { $errors = $model->getFirstErrors(); return array_shift($errors); } } return false; }
[ "public", "function", "getFirstError", "(", ")", "{", "foreach", "(", "$", "this", "->", "models", "as", "$", "model", ")", "{", "if", "(", "$", "model", "->", "hasErrors", "(", ")", ")", "{", "$", "errors", "=", "$", "model", "->", "getFirstErrors",...
Returns the first error of the collection. @return bool|mixed
[ "Returns", "the", "first", "error", "of", "the", "collection", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/Collection.php#L481-L492
45,425
hiqdev/yii2-hiart
src/Collection.php
Collection.triggerModels
public function triggerModels($name, ModelEvent $event = null) { if ($event === null) { $event = new ModelEvent(); } foreach ($this->models as $model) { $model->trigger($name, $event); } return $event->isValid; }
php
public function triggerModels($name, ModelEvent $event = null) { if ($event === null) { $event = new ModelEvent(); } foreach ($this->models as $model) { $model->trigger($name, $event); } return $event->isValid; }
[ "public", "function", "triggerModels", "(", "$", "name", ",", "ModelEvent", "$", "event", "=", "null", ")", "{", "if", "(", "$", "event", "===", "null", ")", "{", "$", "event", "=", "new", "ModelEvent", "(", ")", ";", "}", "foreach", "(", "$", "thi...
Iterates over all of the models and triggers some event. @param string $name the event name @param ModelEvent $event @return bool whether is valid
[ "Iterates", "over", "all", "of", "the", "models", "and", "triggers", "some", "event", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/Collection.php#L579-L589
45,426
hiqdev/yii2-hiart
src/AbstractQueryBuilder.php
AbstractQueryBuilder.update
public function update($table, $columns, $condition = [], array $options = []) { $query = $this->createQuery('update', $table, $options)->body($columns)->where($condition); return $this->createRequest($query); }
php
public function update($table, $columns, $condition = [], array $options = []) { $query = $this->createQuery('update', $table, $options)->body($columns)->where($condition); return $this->createRequest($query); }
[ "public", "function", "update", "(", "$", "table", ",", "$", "columns", ",", "$", "condition", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "query", "=", "$", "this", "->", "createQuery", "(", "'update'", ",", "$", "...
Creates update request. @param string $table @param array $columns @param array $condition @param array $options @return AbstractRequest
[ "Creates", "update", "request", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/AbstractQueryBuilder.php#L104-L109
45,427
hiqdev/yii2-hiart
src/AbstractQueryBuilder.php
AbstractQueryBuilder.delete
public function delete($table, $condition = [], array $options = []) { $query = $this->createQuery('delete', $table, $options)->where($condition); return $this->createRequest($query); }
php
public function delete($table, $condition = [], array $options = []) { $query = $this->createQuery('delete', $table, $options)->where($condition); return $this->createRequest($query); }
[ "public", "function", "delete", "(", "$", "table", ",", "$", "condition", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "query", "=", "$", "this", "->", "createQuery", "(", "'delete'", ",", "$", "table", ",", "$", "op...
Creates delete request. @param string $table @param array $condition @param array $options @return AbstractRequest
[ "Creates", "delete", "request", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/AbstractQueryBuilder.php#L118-L123
45,428
hiqdev/yii2-hiart
src/AbstractQueryBuilder.php
AbstractQueryBuilder.perform
public function perform($action, $table, $body, $options = []) { $query = $this->createQuery($action, $table, $options)->body($body); return $this->createRequest($query); }
php
public function perform($action, $table, $body, $options = []) { $query = $this->createQuery($action, $table, $options)->body($body); return $this->createRequest($query); }
[ "public", "function", "perform", "(", "$", "action", ",", "$", "table", ",", "$", "body", ",", "$", "options", "=", "[", "]", ")", "{", "$", "query", "=", "$", "this", "->", "createQuery", "(", "$", "action", ",", "$", "table", ",", "$", "options...
Creates request for given action. @param string $action @param string $table @param mixed $body @param array $options @return AbstractRequest
[ "Creates", "request", "for", "given", "action", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/AbstractQueryBuilder.php#L133-L138
45,429
hiqdev/yii2-hiart
src/AbstractConnection.php
AbstractConnection.getAuth
public function getAuth() { if ($this->_disabledAuth) { return []; } if ($this->_auth instanceof Closure) { $this->_auth = call_user_func($this->_auth, $this); } return $this->_auth; }
php
public function getAuth() { if ($this->_disabledAuth) { return []; } if ($this->_auth instanceof Closure) { $this->_auth = call_user_func($this->_auth, $this); } return $this->_auth; }
[ "public", "function", "getAuth", "(", ")", "{", "if", "(", "$", "this", "->", "_disabledAuth", ")", "{", "return", "[", "]", ";", "}", "if", "(", "$", "this", "->", "_auth", "instanceof", "Closure", ")", "{", "$", "this", "->", "_auth", "=", "call_...
Returns auth settings. @return array
[ "Returns", "auth", "settings", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/AbstractConnection.php#L105-L115
45,430
hiqdev/yii2-hiart
src/AbstractConnection.php
AbstractConnection.checkResponse
public function checkResponse(ResponseInterface $response) { if (isset($this->_errorChecker)) { $error = call_user_func($this->_errorChecker, $response); } else { $error = $this->getResponseError($response); } if ($error) { throw new ResponseErrorException($error, $response); } }
php
public function checkResponse(ResponseInterface $response) { if (isset($this->_errorChecker)) { $error = call_user_func($this->_errorChecker, $response); } else { $error = $this->getResponseError($response); } if ($error) { throw new ResponseErrorException($error, $response); } }
[ "public", "function", "checkResponse", "(", "ResponseInterface", "$", "response", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "_errorChecker", ")", ")", "{", "$", "error", "=", "call_user_func", "(", "$", "this", "->", "_errorChecker", ",", "$", ...
Checks response method and raises exception if error found. @param ResponseInterface $response response data from API @throws ResponseErrorException when response is invalid
[ "Checks", "response", "method", "and", "raises", "exception", "if", "error", "found", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/AbstractConnection.php#L259-L270
45,431
hiqdev/yii2-hiart
src/AbstractConnection.php
AbstractConnection.getBaseUri
public function getBaseUri() { if (empty($this->baseUriChecked)) { if (preg_match('#^https?://[^/]+$#', $this->baseUri)) { $this->baseUri .= '/'; } $this->baseUriChecked = true; } return $this->baseUri; }
php
public function getBaseUri() { if (empty($this->baseUriChecked)) { if (preg_match('#^https?://[^/]+$#', $this->baseUri)) { $this->baseUri .= '/'; } $this->baseUriChecked = true; } return $this->baseUri; }
[ "public", "function", "getBaseUri", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "baseUriChecked", ")", ")", "{", "if", "(", "preg_match", "(", "'#^https?://[^/]+$#'", ",", "$", "this", "->", "baseUri", ")", ")", "{", "$", "this", "->", ...
Return API base uri. Adds trailing slash if uri is domain only. @return string
[ "Return", "API", "base", "uri", ".", "Adds", "trailing", "slash", "if", "uri", "is", "domain", "only", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/AbstractConnection.php#L287-L297
45,432
hiqdev/yii2-hiart
src/AbstractResponse.php
AbstractResponse.isJson
public function isJson() { $value = $this->getHeader('Content-Type'); if ($value === null) { return false; } return !empty(preg_grep('|application/json|i', $value)); }
php
public function isJson() { $value = $this->getHeader('Content-Type'); if ($value === null) { return false; } return !empty(preg_grep('|application/json|i', $value)); }
[ "public", "function", "isJson", "(", ")", "{", "$", "value", "=", "$", "this", "->", "getHeader", "(", "'Content-Type'", ")", ";", "if", "(", "$", "value", "===", "null", ")", "{", "return", "false", ";", "}", "return", "!", "empty", "(", "preg_grep"...
Method checks whether response is a JSON response. @return bool
[ "Method", "checks", "whether", "response", "is", "a", "JSON", "response", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/AbstractResponse.php#L88-L96
45,433
hiqdev/yii2-hiart
src/curl/Response.php
Response.parseRawResponse
protected function parseRawResponse($data, $info) { $result = []; $headerSize = $info['header_size']; $result['data'] = substr($data, $headerSize); $rawHeaders = explode("\r\n", substr($data, 0, $headerSize)); // First line is status-code HTTP/1.1 200 OK list(, $result['statusCode'], $result['reasonPhrase']) = explode(' ', array_shift($rawHeaders), 3); foreach ($rawHeaders as $line) { if ($line === '') { continue; } list($key, $value) = explode(': ', $line); $result['headers'][strtolower($key)][] = $value; } return $result; }
php
protected function parseRawResponse($data, $info) { $result = []; $headerSize = $info['header_size']; $result['data'] = substr($data, $headerSize); $rawHeaders = explode("\r\n", substr($data, 0, $headerSize)); // First line is status-code HTTP/1.1 200 OK list(, $result['statusCode'], $result['reasonPhrase']) = explode(' ', array_shift($rawHeaders), 3); foreach ($rawHeaders as $line) { if ($line === '') { continue; } list($key, $value) = explode(': ', $line); $result['headers'][strtolower($key)][] = $value; } return $result; }
[ "protected", "function", "parseRawResponse", "(", "$", "data", ",", "$", "info", ")", "{", "$", "result", "=", "[", "]", ";", "$", "headerSize", "=", "$", "info", "[", "'header_size'", "]", ";", "$", "result", "[", "'data'", "]", "=", "substr", "(", ...
Parses raw response and returns parsed information. @param string $data the raw response @param array $info the curl information (result of `gurl_getinfo` call) @return array array with the following keys will be returned: - data: string, response data; - headers: array, response headers; - statusCode: string, the response status-code; - reasonPhrase: string, the response reason phrase (OK, NOT FOUND, etc)
[ "Parses", "raw", "response", "and", "returns", "parsed", "information", "." ]
fca300caa9284b9bd6f6fc1519427eaac9640b6f
https://github.com/hiqdev/yii2-hiart/blob/fca300caa9284b9bd6f6fc1519427eaac9640b6f/src/curl/Response.php#L109-L129
45,434
silverstripe/silverstripe-siteconfig
code/SiteConfig.php
SiteConfig.requireDefaultRecords
public function requireDefaultRecords() { parent::requireDefaultRecords(); $config = DataObject::get_one(SiteConfig::class); if (!$config) { self::make_site_config(); DB::alteration_message("Added default site config", "created"); } }
php
public function requireDefaultRecords() { parent::requireDefaultRecords(); $config = DataObject::get_one(SiteConfig::class); if (!$config) { self::make_site_config(); DB::alteration_message("Added default site config", "created"); } }
[ "public", "function", "requireDefaultRecords", "(", ")", "{", "parent", "::", "requireDefaultRecords", "(", ")", ";", "$", "config", "=", "DataObject", "::", "get_one", "(", "SiteConfig", "::", "class", ")", ";", "if", "(", "!", "$", "config", ")", "{", ...
Setup a default SiteConfig record if none exists.
[ "Setup", "a", "default", "SiteConfig", "record", "if", "none", "exists", "." ]
b501eceefc4a7b40ec3deb119778cb5d3eacaaf8
https://github.com/silverstripe/silverstripe-siteconfig/blob/b501eceefc4a7b40ec3deb119778cb5d3eacaaf8/code/SiteConfig.php#L284-L295
45,435
silverstripe/silverstripe-siteconfig
code/SiteConfig.php
SiteConfig.canView
public function canView($member = null) { if (!$member) { $member = Security::getCurrentUser(); } $extended = $this->extendedCan('canView', $member); if ($extended !== null) { return $extended; } // Assuming all that can edit this object can also view it return $this->canEdit($member); }
php
public function canView($member = null) { if (!$member) { $member = Security::getCurrentUser(); } $extended = $this->extendedCan('canView', $member); if ($extended !== null) { return $extended; } // Assuming all that can edit this object can also view it return $this->canEdit($member); }
[ "public", "function", "canView", "(", "$", "member", "=", "null", ")", "{", "if", "(", "!", "$", "member", ")", "{", "$", "member", "=", "Security", "::", "getCurrentUser", "(", ")", ";", "}", "$", "extended", "=", "$", "this", "->", "extendedCan", ...
Can a user view this SiteConfig instance? @param Member $member @return boolean
[ "Can", "a", "user", "view", "this", "SiteConfig", "instance?" ]
b501eceefc4a7b40ec3deb119778cb5d3eacaaf8
https://github.com/silverstripe/silverstripe-siteconfig/blob/b501eceefc4a7b40ec3deb119778cb5d3eacaaf8/code/SiteConfig.php#L316-L329
45,436
silverstripe/silverstripe-siteconfig
code/SiteConfig.php
SiteConfig.canViewPages
public function canViewPages($member = null) { if (!$member) { $member = Security::getCurrentUser(); } if ($member && Permission::checkMember($member, "ADMIN")) { return true; } $extended = $this->extendedCan('canViewPages', $member); if ($extended !== null) { return $extended; } if (!$this->CanViewType || $this->CanViewType == 'Anyone') { return true; } // check for any logged-in users if ($this->CanViewType === 'LoggedInUsers' && $member) { return true; } // check for specific groups if ($this->CanViewType === 'OnlyTheseUsers' && $member && $member->inGroups($this->ViewerGroups())) { return true; } return false; }
php
public function canViewPages($member = null) { if (!$member) { $member = Security::getCurrentUser(); } if ($member && Permission::checkMember($member, "ADMIN")) { return true; } $extended = $this->extendedCan('canViewPages', $member); if ($extended !== null) { return $extended; } if (!$this->CanViewType || $this->CanViewType == 'Anyone') { return true; } // check for any logged-in users if ($this->CanViewType === 'LoggedInUsers' && $member) { return true; } // check for specific groups if ($this->CanViewType === 'OnlyTheseUsers' && $member && $member->inGroups($this->ViewerGroups())) { return true; } return false; }
[ "public", "function", "canViewPages", "(", "$", "member", "=", "null", ")", "{", "if", "(", "!", "$", "member", ")", "{", "$", "member", "=", "Security", "::", "getCurrentUser", "(", ")", ";", "}", "if", "(", "$", "member", "&&", "Permission", "::", ...
Can a user view pages on this site? This method is only called if a page is set to Inherit, but there is nothing to inherit from. @param Member $member @return boolean
[ "Can", "a", "user", "view", "pages", "on", "this", "site?", "This", "method", "is", "only", "called", "if", "a", "page", "is", "set", "to", "Inherit", "but", "there", "is", "nothing", "to", "inherit", "from", "." ]
b501eceefc4a7b40ec3deb119778cb5d3eacaaf8
https://github.com/silverstripe/silverstripe-siteconfig/blob/b501eceefc4a7b40ec3deb119778cb5d3eacaaf8/code/SiteConfig.php#L339-L369
45,437
silverstripe/silverstripe-siteconfig
code/SiteConfig.php
SiteConfig.canEditPages
public function canEditPages($member = null) { if (!$member) { $member = Security::getCurrentUser(); } if ($member && Permission::checkMember($member, "ADMIN")) { return true; } $extended = $this->extendedCan('canEditPages', $member); if ($extended !== null) { return $extended; } // check for any logged-in users with CMS access if ($this->CanEditType === 'LoggedInUsers' && Permission::checkMember($member, $this->config()->get('required_permission')) ) { return true; } // check for specific groups if ($this->CanEditType === 'OnlyTheseUsers' && $member && $member->inGroups($this->EditorGroups())) { return true; } return false; }
php
public function canEditPages($member = null) { if (!$member) { $member = Security::getCurrentUser(); } if ($member && Permission::checkMember($member, "ADMIN")) { return true; } $extended = $this->extendedCan('canEditPages', $member); if ($extended !== null) { return $extended; } // check for any logged-in users with CMS access if ($this->CanEditType === 'LoggedInUsers' && Permission::checkMember($member, $this->config()->get('required_permission')) ) { return true; } // check for specific groups if ($this->CanEditType === 'OnlyTheseUsers' && $member && $member->inGroups($this->EditorGroups())) { return true; } return false; }
[ "public", "function", "canEditPages", "(", "$", "member", "=", "null", ")", "{", "if", "(", "!", "$", "member", ")", "{", "$", "member", "=", "Security", "::", "getCurrentUser", "(", ")", ";", "}", "if", "(", "$", "member", "&&", "Permission", "::", ...
Can a user edit pages on this site? This method is only called if a page is set to Inherit, but there is nothing to inherit from, or on new records without a parent. @param Member $member @return boolean
[ "Can", "a", "user", "edit", "pages", "on", "this", "site?", "This", "method", "is", "only", "called", "if", "a", "page", "is", "set", "to", "Inherit", "but", "there", "is", "nothing", "to", "inherit", "from", "or", "on", "new", "records", "without", "a...
b501eceefc4a7b40ec3deb119778cb5d3eacaaf8
https://github.com/silverstripe/silverstripe-siteconfig/blob/b501eceefc4a7b40ec3deb119778cb5d3eacaaf8/code/SiteConfig.php#L379-L407
45,438
silverstripe/silverstripe-siteconfig
code/SiteConfig.php
SiteConfig.canCreateTopLevel
public function canCreateTopLevel($member = null) { if (!$member) { $member = Security::getCurrentUser(); } if ($member && Permission::checkMember($member, "ADMIN")) { return true; } $extended = $this->extendedCan('canCreateTopLevel', $member); if ($extended !== null) { return $extended; } // check for any logged-in users with CMS permission if ($this->CanCreateTopLevelType === 'LoggedInUsers' && Permission::checkMember($member, $this->config()->get('required_permission')) ) { return true; } // check for specific groups if ($this->CanCreateTopLevelType === 'OnlyTheseUsers' && $member && $member->inGroups($this->CreateTopLevelGroups()) ) { return true; } return false; }
php
public function canCreateTopLevel($member = null) { if (!$member) { $member = Security::getCurrentUser(); } if ($member && Permission::checkMember($member, "ADMIN")) { return true; } $extended = $this->extendedCan('canCreateTopLevel', $member); if ($extended !== null) { return $extended; } // check for any logged-in users with CMS permission if ($this->CanCreateTopLevelType === 'LoggedInUsers' && Permission::checkMember($member, $this->config()->get('required_permission')) ) { return true; } // check for specific groups if ($this->CanCreateTopLevelType === 'OnlyTheseUsers' && $member && $member->inGroups($this->CreateTopLevelGroups()) ) { return true; } return false; }
[ "public", "function", "canCreateTopLevel", "(", "$", "member", "=", "null", ")", "{", "if", "(", "!", "$", "member", ")", "{", "$", "member", "=", "Security", "::", "getCurrentUser", "(", ")", ";", "}", "if", "(", "$", "member", "&&", "Permission", "...
Can a user create pages in the root of this site? @param Member $member @return boolean
[ "Can", "a", "user", "create", "pages", "in", "the", "root", "of", "this", "site?" ]
b501eceefc4a7b40ec3deb119778cb5d3eacaaf8
https://github.com/silverstripe/silverstripe-siteconfig/blob/b501eceefc4a7b40ec3deb119778cb5d3eacaaf8/code/SiteConfig.php#L450-L481
45,439
doctrine/skeleton-mapper
lib/Doctrine/SkeletonMapper/Persister/BasicObjectPersister.php
BasicObjectPersister.preparePersistChangeSet
public function preparePersistChangeSet($object) : array { if (! $object instanceof PersistableInterface) { throw new InvalidArgumentException( sprintf('%s must implement PersistableInterface.', get_class($object)) ); } return $object->preparePersistChangeSet(); }
php
public function preparePersistChangeSet($object) : array { if (! $object instanceof PersistableInterface) { throw new InvalidArgumentException( sprintf('%s must implement PersistableInterface.', get_class($object)) ); } return $object->preparePersistChangeSet(); }
[ "public", "function", "preparePersistChangeSet", "(", "$", "object", ")", ":", "array", "{", "if", "(", "!", "$", "object", "instanceof", "PersistableInterface", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'%s must implement Persistab...
Prepares an object changeset for persistence. @param object $object @return mixed[]
[ "Prepares", "an", "object", "changeset", "for", "persistence", "." ]
478c0fafcdc2df37159193b74fedaf89643891eb
https://github.com/doctrine/skeleton-mapper/blob/478c0fafcdc2df37159193b74fedaf89643891eb/lib/Doctrine/SkeletonMapper/Persister/BasicObjectPersister.php#L52-L61
45,440
doctrine/skeleton-mapper
lib/Doctrine/SkeletonMapper/Persister/BasicObjectPersister.php
BasicObjectPersister.prepareUpdateChangeSet
public function prepareUpdateChangeSet($object, ChangeSet $changeSet) : array { if (! $object instanceof PersistableInterface) { throw new InvalidArgumentException(sprintf('%s must implement PersistableInterface.', get_class($object))); } return $object->prepareUpdateChangeSet($changeSet); }
php
public function prepareUpdateChangeSet($object, ChangeSet $changeSet) : array { if (! $object instanceof PersistableInterface) { throw new InvalidArgumentException(sprintf('%s must implement PersistableInterface.', get_class($object))); } return $object->prepareUpdateChangeSet($changeSet); }
[ "public", "function", "prepareUpdateChangeSet", "(", "$", "object", ",", "ChangeSet", "$", "changeSet", ")", ":", "array", "{", "if", "(", "!", "$", "object", "instanceof", "PersistableInterface", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprin...
Prepares an object changeset for update. @param object $object @return mixed[]
[ "Prepares", "an", "object", "changeset", "for", "update", "." ]
478c0fafcdc2df37159193b74fedaf89643891eb
https://github.com/doctrine/skeleton-mapper/blob/478c0fafcdc2df37159193b74fedaf89643891eb/lib/Doctrine/SkeletonMapper/Persister/BasicObjectPersister.php#L70-L77
45,441
doctrine/skeleton-mapper
lib/Doctrine/SkeletonMapper/Persister/BasicObjectPersister.php
BasicObjectPersister.assignIdentifier
public function assignIdentifier($object, array $identifier) : void { if (! $object instanceof IdentifiableInterface) { throw new InvalidArgumentException(sprintf('%s must implement IdentifiableInterface.', get_class($object))); } $object->assignIdentifier($identifier); }
php
public function assignIdentifier($object, array $identifier) : void { if (! $object instanceof IdentifiableInterface) { throw new InvalidArgumentException(sprintf('%s must implement IdentifiableInterface.', get_class($object))); } $object->assignIdentifier($identifier); }
[ "public", "function", "assignIdentifier", "(", "$", "object", ",", "array", "$", "identifier", ")", ":", "void", "{", "if", "(", "!", "$", "object", "instanceof", "IdentifiableInterface", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(...
Assign identifier to object. @param object $object @param mixed[] $identifier
[ "Assign", "identifier", "to", "object", "." ]
478c0fafcdc2df37159193b74fedaf89643891eb
https://github.com/doctrine/skeleton-mapper/blob/478c0fafcdc2df37159193b74fedaf89643891eb/lib/Doctrine/SkeletonMapper/Persister/BasicObjectPersister.php#L85-L92
45,442
doctrine/skeleton-mapper
lib/Doctrine/SkeletonMapper/UnitOfWork.php
UnitOfWork.commit
public function commit() : void { $this->eventDispatcher->dispatchPreFlush(); if ($this->objectsToPersist === [] && $this->objectsToUpdate === [] && $this->objectsToRemove === [] ) { return; // Nothing to do. } $objects = array_merge( $this->objectsToPersist, $this->objectsToUpdate, $this->objectsToRemove ); $this->eventDispatcher->dispatchPreFlushLifecycleCallbacks($objects); $this->eventDispatcher->dispatchOnFlush(); $this->persister->executePersists(); $this->persister->executeUpdates(); $this->persister->executeRemoves(); $this->eventDispatcher->dispatchPostFlush(); $this->objectsToPersist = []; $this->objectsToUpdate = []; $this->objectsToRemove = []; $this->objectChangeSets = new ChangeSets(); }
php
public function commit() : void { $this->eventDispatcher->dispatchPreFlush(); if ($this->objectsToPersist === [] && $this->objectsToUpdate === [] && $this->objectsToRemove === [] ) { return; // Nothing to do. } $objects = array_merge( $this->objectsToPersist, $this->objectsToUpdate, $this->objectsToRemove ); $this->eventDispatcher->dispatchPreFlushLifecycleCallbacks($objects); $this->eventDispatcher->dispatchOnFlush(); $this->persister->executePersists(); $this->persister->executeUpdates(); $this->persister->executeRemoves(); $this->eventDispatcher->dispatchPostFlush(); $this->objectsToPersist = []; $this->objectsToUpdate = []; $this->objectsToRemove = []; $this->objectChangeSets = new ChangeSets(); }
[ "public", "function", "commit", "(", ")", ":", "void", "{", "$", "this", "->", "eventDispatcher", "->", "dispatchPreFlush", "(", ")", ";", "if", "(", "$", "this", "->", "objectsToPersist", "===", "[", "]", "&&", "$", "this", "->", "objectsToUpdate", "===...
Commit the contents of the unit of work.
[ "Commit", "the", "contents", "of", "the", "unit", "of", "work", "." ]
478c0fafcdc2df37159193b74fedaf89643891eb
https://github.com/doctrine/skeleton-mapper/blob/478c0fafcdc2df37159193b74fedaf89643891eb/lib/Doctrine/SkeletonMapper/UnitOfWork.php#L177-L207
45,443
doctrine/skeleton-mapper
lib/Doctrine/SkeletonMapper/UnitOfWork.php
UnitOfWork.propertyChanged
public function propertyChanged($object, $propertyName, $oldValue, $newValue) : void { if (! $this->isInIdentityMap($object)) { return; } if (! $this->isScheduledForUpdate($object)) { $this->update($object); } $this->objectChangeSets->addObjectChange( $object, new Change($propertyName, $oldValue, $newValue) ); }
php
public function propertyChanged($object, $propertyName, $oldValue, $newValue) : void { if (! $this->isInIdentityMap($object)) { return; } if (! $this->isScheduledForUpdate($object)) { $this->update($object); } $this->objectChangeSets->addObjectChange( $object, new Change($propertyName, $oldValue, $newValue) ); }
[ "public", "function", "propertyChanged", "(", "$", "object", ",", "$", "propertyName", ",", "$", "oldValue", ",", "$", "newValue", ")", ":", "void", "{", "if", "(", "!", "$", "this", "->", "isInIdentityMap", "(", "$", "object", ")", ")", "{", "return",...
Notifies this UnitOfWork of a property change in an object. @param object $object The entity that owns the property. @param string $propertyName The name of the property that changed. @param mixed $oldValue The old value of the property. @param mixed $newValue The new value of the property.
[ "Notifies", "this", "UnitOfWork", "of", "a", "property", "change", "in", "an", "object", "." ]
478c0fafcdc2df37159193b74fedaf89643891eb
https://github.com/doctrine/skeleton-mapper/blob/478c0fafcdc2df37159193b74fedaf89643891eb/lib/Doctrine/SkeletonMapper/UnitOfWork.php#L267-L281
45,444
doctrine/skeleton-mapper
lib/Doctrine/SkeletonMapper/Event/PreUpdateEventArgs.php
PreUpdateEventArgs.getOldValue
public function getOldValue(string $field) { $change = $this->objectChangeSet->getFieldChange($field); if ($change !== null) { return $change->getOldValue(); } }
php
public function getOldValue(string $field) { $change = $this->objectChangeSet->getFieldChange($field); if ($change !== null) { return $change->getOldValue(); } }
[ "public", "function", "getOldValue", "(", "string", "$", "field", ")", "{", "$", "change", "=", "$", "this", "->", "objectChangeSet", "->", "getFieldChange", "(", "$", "field", ")", ";", "if", "(", "$", "change", "!==", "null", ")", "{", "return", "$",...
Gets the old value of the changeset of the changed field. @return mixed
[ "Gets", "the", "old", "value", "of", "the", "changeset", "of", "the", "changed", "field", "." ]
478c0fafcdc2df37159193b74fedaf89643891eb
https://github.com/doctrine/skeleton-mapper/blob/478c0fafcdc2df37159193b74fedaf89643891eb/lib/Doctrine/SkeletonMapper/Event/PreUpdateEventArgs.php#L52-L59
45,445
doctrine/skeleton-mapper
lib/Doctrine/SkeletonMapper/Event/PreUpdateEventArgs.php
PreUpdateEventArgs.getNewValue
public function getNewValue(string $field) { $change = $this->objectChangeSet->getFieldChange($field); if ($change !== null) { return $change->getNewValue(); } }
php
public function getNewValue(string $field) { $change = $this->objectChangeSet->getFieldChange($field); if ($change !== null) { return $change->getNewValue(); } }
[ "public", "function", "getNewValue", "(", "string", "$", "field", ")", "{", "$", "change", "=", "$", "this", "->", "objectChangeSet", "->", "getFieldChange", "(", "$", "field", ")", ";", "if", "(", "$", "change", "!==", "null", ")", "{", "return", "$",...
Gets the new value of the changeset of the changed field. @return mixed
[ "Gets", "the", "new", "value", "of", "the", "changeset", "of", "the", "changed", "field", "." ]
478c0fafcdc2df37159193b74fedaf89643891eb
https://github.com/doctrine/skeleton-mapper/blob/478c0fafcdc2df37159193b74fedaf89643891eb/lib/Doctrine/SkeletonMapper/Event/PreUpdateEventArgs.php#L66-L73
45,446
doctrine/skeleton-mapper
lib/Doctrine/SkeletonMapper/ObjectRepository/ObjectRepository.php
ObjectRepository.findAll
public function findAll() : array { $objectsData = $this->objectDataRepository->findAll(); $objects = []; foreach ($objectsData as $objectData) { $object = $this->getOrCreateObject($objectData); if ($object === null) { throw new InvalidArgumentException('Could not create object.'); } $objects[] = $object; } return $objects; }
php
public function findAll() : array { $objectsData = $this->objectDataRepository->findAll(); $objects = []; foreach ($objectsData as $objectData) { $object = $this->getOrCreateObject($objectData); if ($object === null) { throw new InvalidArgumentException('Could not create object.'); } $objects[] = $object; } return $objects; }
[ "public", "function", "findAll", "(", ")", ":", "array", "{", "$", "objectsData", "=", "$", "this", "->", "objectDataRepository", "->", "findAll", "(", ")", ";", "$", "objects", "=", "[", "]", ";", "foreach", "(", "$", "objectsData", "as", "$", "object...
Finds all objects in the repository. @return object[] The objects.
[ "Finds", "all", "objects", "in", "the", "repository", "." ]
478c0fafcdc2df37159193b74fedaf89643891eb
https://github.com/doctrine/skeleton-mapper/blob/478c0fafcdc2df37159193b74fedaf89643891eb/lib/Doctrine/SkeletonMapper/ObjectRepository/ObjectRepository.php#L90-L106
45,447
Elao/WebProfilerExtraBundle
DataCollector/AsseticDataCollector.php
AsseticDataCollector.collect
public function collect(Request $request, Response $response, \Exception $exception = null) { $collections = array(); foreach ($this->getAssetManager()->getNames() as $name) { $collection = $this->getAssetManager()->get($name); $assets = array(); $filters = array(); foreach ($collection->all() as $asset) { $assets[] = $asset->getSourcePath(); } foreach ($collection->getFilters() as $filter) { $filters[] = get_class($filter); } $collections[$name] = array( 'target' => $collection->getTargetPath(), 'assets' => $assets, 'filters' => $filters ); } $this->data['collections'] = $collections; }
php
public function collect(Request $request, Response $response, \Exception $exception = null) { $collections = array(); foreach ($this->getAssetManager()->getNames() as $name) { $collection = $this->getAssetManager()->get($name); $assets = array(); $filters = array(); foreach ($collection->all() as $asset) { $assets[] = $asset->getSourcePath(); } foreach ($collection->getFilters() as $filter) { $filters[] = get_class($filter); } $collections[$name] = array( 'target' => $collection->getTargetPath(), 'assets' => $assets, 'filters' => $filters ); } $this->data['collections'] = $collections; }
[ "public", "function", "collect", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "\\", "Exception", "$", "exception", "=", "null", ")", "{", "$", "collections", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "get...
Collect assets informations from Assetic Asset Manager @param Request $request The Request Object @param Response $response The Response Object @param \Exception $exception Exception
[ "Collect", "assets", "informations", "from", "Assetic", "Asset", "Manager" ]
edbcd31a3e0b0940b0ed0301d467f2419280d679
https://github.com/Elao/WebProfilerExtraBundle/blob/edbcd31a3e0b0940b0ed0301d467f2419280d679/DataCollector/AsseticDataCollector.php#L45-L70
45,448
Elao/WebProfilerExtraBundle
DataCollector/ContainerDataCollector.php
ContainerDataCollector.collect
public function collect(Request $request, Response $response, \Exception $exception = null) { $parameters = array(); $services = array(); $this->loadContainerBuilder(); if ($this->containerBuilder !== false) { foreach ($this->containerBuilder->getParameterBag()->all() as $key => $value) { $service = substr($key, 0, strpos($key, '.')); if (!isset($parameters[$service])) { $parameters[$service] = array(); } $parameters[$service][$key] = $value; } $serviceIds = $this->containerBuilder->getServiceIds(); foreach ($serviceIds as $serviceId) { $definition = $this->resolveServiceDefinition($serviceId); if ($definition instanceof Definition && $definition->isPublic()) { $services[$serviceId] = array('class' => $definition->getClass()); } elseif ($definition instanceof Alias) { $services[$serviceId] = array('alias' => $definition); } else { continue; // We don't want private services } } ksort($services); ksort($parameters); } $this->data['parameters'] = $parameters; $this->data['services'] = $services; }
php
public function collect(Request $request, Response $response, \Exception $exception = null) { $parameters = array(); $services = array(); $this->loadContainerBuilder(); if ($this->containerBuilder !== false) { foreach ($this->containerBuilder->getParameterBag()->all() as $key => $value) { $service = substr($key, 0, strpos($key, '.')); if (!isset($parameters[$service])) { $parameters[$service] = array(); } $parameters[$service][$key] = $value; } $serviceIds = $this->containerBuilder->getServiceIds(); foreach ($serviceIds as $serviceId) { $definition = $this->resolveServiceDefinition($serviceId); if ($definition instanceof Definition && $definition->isPublic()) { $services[$serviceId] = array('class' => $definition->getClass()); } elseif ($definition instanceof Alias) { $services[$serviceId] = array('alias' => $definition); } else { continue; // We don't want private services } } ksort($services); ksort($parameters); } $this->data['parameters'] = $parameters; $this->data['services'] = $services; }
[ "public", "function", "collect", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "\\", "Exception", "$", "exception", "=", "null", ")", "{", "$", "parameters", "=", "array", "(", ")", ";", "$", "services", "=", "array", "(", ")",...
Collect information about services and parameters from the cached dumped xml container @param Request $request The Request Object @param Response $response The Response Object @param \Exception $exception The Exception
[ "Collect", "information", "about", "services", "and", "parameters", "from", "the", "cached", "dumped", "xml", "container" ]
edbcd31a3e0b0940b0ed0301d467f2419280d679
https://github.com/Elao/WebProfilerExtraBundle/blob/edbcd31a3e0b0940b0ed0301d467f2419280d679/DataCollector/ContainerDataCollector.php#L68-L102
45,449
Elao/WebProfilerExtraBundle
DataCollector/RoutingDataCollector.php
RoutingDataCollector.collect
public function collect(Request $request, Response $response, \Exception $exception = null) { $collection = $this->router->getRouteCollection(); $_ressources = $collection->getResources(); $_routes = $collection->all(); $routes = array(); $ressources = array(); foreach ($_ressources as $ressource) { $ressources[] = array( 'type' => get_class($ressource), 'path' => $ressource->__toString() ); } foreach ($_routes as $routeName => $route) { $defaults = $route->getDefaults(); $requirements = $route->getRequirements(); $controller = isset($defaults['_controller']) ? $defaults['_controller'] : 'unknown'; $routes[$routeName] = array( 'name' => $routeName, 'pattern' => $route->getPath(), 'controller' => $controller, 'method' => isset($requirements['_method']) ? $requirements['_method'] : 'ANY', ); } ksort($routes); $this->data['matchRoute'] = $request->attributes->get('_route'); $this->data['routes'] = $routes; $this->data['ressources'] = $ressources; }
php
public function collect(Request $request, Response $response, \Exception $exception = null) { $collection = $this->router->getRouteCollection(); $_ressources = $collection->getResources(); $_routes = $collection->all(); $routes = array(); $ressources = array(); foreach ($_ressources as $ressource) { $ressources[] = array( 'type' => get_class($ressource), 'path' => $ressource->__toString() ); } foreach ($_routes as $routeName => $route) { $defaults = $route->getDefaults(); $requirements = $route->getRequirements(); $controller = isset($defaults['_controller']) ? $defaults['_controller'] : 'unknown'; $routes[$routeName] = array( 'name' => $routeName, 'pattern' => $route->getPath(), 'controller' => $controller, 'method' => isset($requirements['_method']) ? $requirements['_method'] : 'ANY', ); } ksort($routes); $this->data['matchRoute'] = $request->attributes->get('_route'); $this->data['routes'] = $routes; $this->data['ressources'] = $ressources; }
[ "public", "function", "collect", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "\\", "Exception", "$", "exception", "=", "null", ")", "{", "$", "collection", "=", "$", "this", "->", "router", "->", "getRouteCollection", "(", ")", ...
Collects the Information on the Route @param Request $request The Request Object @param Response $response The Response Object @param \Exception $exception The Exception
[ "Collects", "the", "Information", "on", "the", "Route" ]
edbcd31a3e0b0940b0ed0301d467f2419280d679
https://github.com/Elao/WebProfilerExtraBundle/blob/edbcd31a3e0b0940b0ed0301d467f2419280d679/DataCollector/RoutingDataCollector.php#L47-L79
45,450
Elao/WebProfilerExtraBundle
DataCollector/TwigDataCollector.php
TwigDataCollector.collect
public function collect(Request $request, Response $response, \Exception $exception = null) { $filters = array(); $tests = array(); $extensions = array(); $functions = array(); foreach ($this->getTwig()->getExtensions() as $extensionName => $extension) { $extensions[] = array( 'name' => $extensionName, 'class' => get_class($extension) ); foreach ($extension->getFilters() as $filterName => $filter) { if ($filter instanceof \Twig_FilterInterface) { $call = $filter->compile(); if (is_array($call) && is_callable($call)) { $call = 'Method '.$call[1].' of an object '.get_class($call[0]); } } else { $call = $filter->getName(); } $filters[] = array( 'name' => $filterName, 'extension' => $extensionName, 'call' => $call, ); } foreach ($extension->getTests() as $testName => $test) { if ($test instanceof \Twig_TestInterface) { $call = $test->compile(); } else { $call = $test->getName(); } $tests[] = array( 'name' => $testName, 'extension' => $extensionName, 'call' => $call, ); } foreach ($extension->getFunctions() as $functionName => $function) { if ($function instanceof \Twig_FunctionInterface) { $call = $function->compile(); } else { $call = $function->getName(); } $functions[] = array( 'name' => $functionName, 'extension' => $extensionName, 'call' => $call, ); } } $globals = array(); foreach ($this->getTwig()->getGlobals() as $globalName => $global) { $globals[] = array( 'name' => $globalName, 'value' => $this->getVarDump($global), ); } $this->data['globals'] = $globals; $this->data['extensions'] = $extensions; $this->data['tests'] = $tests; $this->data['filters'] = $filters; $this->data['functions'] = $functions; }
php
public function collect(Request $request, Response $response, \Exception $exception = null) { $filters = array(); $tests = array(); $extensions = array(); $functions = array(); foreach ($this->getTwig()->getExtensions() as $extensionName => $extension) { $extensions[] = array( 'name' => $extensionName, 'class' => get_class($extension) ); foreach ($extension->getFilters() as $filterName => $filter) { if ($filter instanceof \Twig_FilterInterface) { $call = $filter->compile(); if (is_array($call) && is_callable($call)) { $call = 'Method '.$call[1].' of an object '.get_class($call[0]); } } else { $call = $filter->getName(); } $filters[] = array( 'name' => $filterName, 'extension' => $extensionName, 'call' => $call, ); } foreach ($extension->getTests() as $testName => $test) { if ($test instanceof \Twig_TestInterface) { $call = $test->compile(); } else { $call = $test->getName(); } $tests[] = array( 'name' => $testName, 'extension' => $extensionName, 'call' => $call, ); } foreach ($extension->getFunctions() as $functionName => $function) { if ($function instanceof \Twig_FunctionInterface) { $call = $function->compile(); } else { $call = $function->getName(); } $functions[] = array( 'name' => $functionName, 'extension' => $extensionName, 'call' => $call, ); } } $globals = array(); foreach ($this->getTwig()->getGlobals() as $globalName => $global) { $globals[] = array( 'name' => $globalName, 'value' => $this->getVarDump($global), ); } $this->data['globals'] = $globals; $this->data['extensions'] = $extensions; $this->data['tests'] = $tests; $this->data['filters'] = $filters; $this->data['functions'] = $functions; }
[ "public", "function", "collect", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "\\", "Exception", "$", "exception", "=", "null", ")", "{", "$", "filters", "=", "array", "(", ")", ";", "$", "tests", "=", "array", "(", ")", ";"...
Collect information from Twig @param Request $request The Request Object @param Response $response The Response Object @param \Exception $exception The Exception
[ "Collect", "information", "from", "Twig" ]
edbcd31a3e0b0940b0ed0301d467f2419280d679
https://github.com/Elao/WebProfilerExtraBundle/blob/edbcd31a3e0b0940b0ed0301d467f2419280d679/DataCollector/TwigDataCollector.php#L46-L118
45,451
Elao/WebProfilerExtraBundle
DataCollector/TwigDataCollector.php
TwigDataCollector.collectTemplateData
public function collectTemplateData($templateName, $parameters, $templatePath = null) { $collectedParameters = array(); foreach ($parameters as $name => $value) { $collectedParameters[$name] = array( 'type' => in_array(gettype($value), array('object', 'resource')) ? get_class($value) : gettype($value), 'value' => in_array(gettype($value), array('object', 'resource', 'array')) ? null : $value, ); } $this->data['templates'][] = array( 'name' => $templateName, 'path' => $templatePath, 'parameters' => $collectedParameters ); }
php
public function collectTemplateData($templateName, $parameters, $templatePath = null) { $collectedParameters = array(); foreach ($parameters as $name => $value) { $collectedParameters[$name] = array( 'type' => in_array(gettype($value), array('object', 'resource')) ? get_class($value) : gettype($value), 'value' => in_array(gettype($value), array('object', 'resource', 'array')) ? null : $value, ); } $this->data['templates'][] = array( 'name' => $templateName, 'path' => $templatePath, 'parameters' => $collectedParameters ); }
[ "public", "function", "collectTemplateData", "(", "$", "templateName", ",", "$", "parameters", ",", "$", "templatePath", "=", "null", ")", "{", "$", "collectedParameters", "=", "array", "(", ")", ";", "foreach", "(", "$", "parameters", "as", "$", "name", "...
Collects data on the twig templates rendered @param mixed $templateName The template name @param array $parameters The array of parameters passed to the template @param array $templatePath The template path
[ "Collects", "data", "on", "the", "twig", "templates", "rendered" ]
edbcd31a3e0b0940b0ed0301d467f2419280d679
https://github.com/Elao/WebProfilerExtraBundle/blob/edbcd31a3e0b0940b0ed0301d467f2419280d679/DataCollector/TwigDataCollector.php#L145-L160
45,452
Elao/WebProfilerExtraBundle
DataCollector/TwigDataCollector.php
TwigDataCollector.getVarDump
protected function getVarDump($var) { $varType = gettype($var); switch ($varType) { case 'boolean': case 'integer': case 'double': case 'NULL': case 'ressource': return print_r($var, 1); case 'string': return (250 < strlen($var)) ? substr($var, 0, 250).'...' : $var; case 'object': return 'Object instance of ' . get_class($var); case 'array': $formated_array = array(); foreach ($var as $key => $value) { $formated_array[$key] = $this->getVarDump($value); } return print_r($formated_array, 1); } }
php
protected function getVarDump($var) { $varType = gettype($var); switch ($varType) { case 'boolean': case 'integer': case 'double': case 'NULL': case 'ressource': return print_r($var, 1); case 'string': return (250 < strlen($var)) ? substr($var, 0, 250).'...' : $var; case 'object': return 'Object instance of ' . get_class($var); case 'array': $formated_array = array(); foreach ($var as $key => $value) { $formated_array[$key] = $this->getVarDump($value); } return print_r($formated_array, 1); } }
[ "protected", "function", "getVarDump", "(", "$", "var", ")", "{", "$", "varType", "=", "gettype", "(", "$", "var", ")", ";", "switch", "(", "$", "varType", ")", "{", "case", "'boolean'", ":", "case", "'integer'", ":", "case", "'double'", ":", "case", ...
Returns var_dump like of a variable but avoiding flood dumping @return string Formated var_dump
[ "Returns", "var_dump", "like", "of", "a", "variable", "but", "avoiding", "flood", "dumping" ]
edbcd31a3e0b0940b0ed0301d467f2419280d679
https://github.com/Elao/WebProfilerExtraBundle/blob/edbcd31a3e0b0940b0ed0301d467f2419280d679/DataCollector/TwigDataCollector.php#L290-L313
45,453
blongden/hal
src/HalLinkContainer.php
HalLinkContainer.get
public function get($rel) { if (array_key_exists($rel, $this)) { return $this[$rel]; } if (isset($this['curies'])) { foreach ($this['curies'] as $link) { $prefix = strstr($link->getUri(), '{rel}', true); if (strpos($rel, $prefix) === 0) { // looks like it is $shortrel = substr($rel, strlen($prefix)); $attrs = $link->getAttributes(); $curie = "{$attrs['name']}:$shortrel"; if (isset($this[$curie])) { return $this[$curie]; } } } } return false; }
php
public function get($rel) { if (array_key_exists($rel, $this)) { return $this[$rel]; } if (isset($this['curies'])) { foreach ($this['curies'] as $link) { $prefix = strstr($link->getUri(), '{rel}', true); if (strpos($rel, $prefix) === 0) { // looks like it is $shortrel = substr($rel, strlen($prefix)); $attrs = $link->getAttributes(); $curie = "{$attrs['name']}:$shortrel"; if (isset($this[$curie])) { return $this[$curie]; } } } } return false; }
[ "public", "function", "get", "(", "$", "rel", ")", "{", "if", "(", "array_key_exists", "(", "$", "rel", ",", "$", "this", ")", ")", "{", "return", "$", "this", "[", "$", "rel", "]", ";", "}", "if", "(", "isset", "(", "$", "this", "[", "'curies'...
Retrieve a link from the container by rel. Also resolve any curie links if they are set. @param string $rel The link relation required. @return array|bool Link if found. Otherwise false.
[ "Retrieve", "a", "link", "from", "the", "container", "by", "rel", ".", "Also", "resolve", "any", "curie", "links", "if", "they", "are", "set", "." ]
84ddd8b5db2cc07cae7f14c72838bd1d0042ddce
https://github.com/blongden/hal/blob/84ddd8b5db2cc07cae7f14c72838bd1d0042ddce/src/HalLinkContainer.php#L32-L54
45,454
php-enqueue/fs
LegacyFilesystemLock.php
LockHandler.lock
public function lock($blocking = false) { if ($this->handle) { return true; } $error = null; // Silence error reporting set_error_handler(function ($errno, $msg) use (&$error) { $error = $msg; }); if (!$this->handle = fopen($this->file, 'r')) { if ($this->handle = fopen($this->file, 'x')) { chmod($this->file, 0444); } elseif (!$this->handle = fopen($this->file, 'r')) { usleep(100); // Give some time for chmod() to complete $this->handle = fopen($this->file, 'r'); } } restore_error_handler(); if (!$this->handle) { throw new IOException($error, 0, null, $this->file); } // On Windows, even if PHP doc says the contrary, LOCK_NB works, see // https://bugs.php.net/54129 if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) { fclose($this->handle); $this->handle = null; return false; } return true; }
php
public function lock($blocking = false) { if ($this->handle) { return true; } $error = null; // Silence error reporting set_error_handler(function ($errno, $msg) use (&$error) { $error = $msg; }); if (!$this->handle = fopen($this->file, 'r')) { if ($this->handle = fopen($this->file, 'x')) { chmod($this->file, 0444); } elseif (!$this->handle = fopen($this->file, 'r')) { usleep(100); // Give some time for chmod() to complete $this->handle = fopen($this->file, 'r'); } } restore_error_handler(); if (!$this->handle) { throw new IOException($error, 0, null, $this->file); } // On Windows, even if PHP doc says the contrary, LOCK_NB works, see // https://bugs.php.net/54129 if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) { fclose($this->handle); $this->handle = null; return false; } return true; }
[ "public", "function", "lock", "(", "$", "blocking", "=", "false", ")", "{", "if", "(", "$", "this", "->", "handle", ")", "{", "return", "true", ";", "}", "$", "error", "=", "null", ";", "// Silence error reporting", "set_error_handler", "(", "function", ...
Lock the resource. @param bool $blocking Wait until the lock is released @throws IOException If the lock file could not be created or opened @return bool Returns true if the lock was acquired, false otherwise
[ "Lock", "the", "resource", "." ]
b22188fca607fb7897c97bb4592d11d7eaaa60fe
https://github.com/php-enqueue/fs/blob/b22188fca607fb7897c97bb4592d11d7eaaa60fe/LegacyFilesystemLock.php#L135-L172
45,455
php-enqueue/fs
LegacyFilesystemLock.php
LockHandler.release
public function release() { if ($this->handle) { flock($this->handle, LOCK_UN | LOCK_NB); fclose($this->handle); $this->handle = null; } }
php
public function release() { if ($this->handle) { flock($this->handle, LOCK_UN | LOCK_NB); fclose($this->handle); $this->handle = null; } }
[ "public", "function", "release", "(", ")", "{", "if", "(", "$", "this", "->", "handle", ")", "{", "flock", "(", "$", "this", "->", "handle", ",", "LOCK_UN", "|", "LOCK_NB", ")", ";", "fclose", "(", "$", "this", "->", "handle", ")", ";", "$", "thi...
Release the resource.
[ "Release", "the", "resource", "." ]
b22188fca607fb7897c97bb4592d11d7eaaa60fe
https://github.com/php-enqueue/fs/blob/b22188fca607fb7897c97bb4592d11d7eaaa60fe/LegacyFilesystemLock.php#L177-L184
45,456
Pawka/phrozn
Phrozn/Site/View/Base.php
Base.compile
public function compile($vars = array()) { $out = $this->render($vars); $outputFile = $this->getOutputFile(); $destinationDir = dirname($outputFile); if (!is_dir($destinationDir)) { mkdir($destinationDir, 0777, true); } if (!is_dir($outputFile)) { file_put_contents($outputFile, $out); } else { throw new \RuntimeException(sprintf( 'Output path "%s" is directory.', $outputFile)); } return $out; }
php
public function compile($vars = array()) { $out = $this->render($vars); $outputFile = $this->getOutputFile(); $destinationDir = dirname($outputFile); if (!is_dir($destinationDir)) { mkdir($destinationDir, 0777, true); } if (!is_dir($outputFile)) { file_put_contents($outputFile, $out); } else { throw new \RuntimeException(sprintf( 'Output path "%s" is directory.', $outputFile)); } return $out; }
[ "public", "function", "compile", "(", "$", "vars", "=", "array", "(", ")", ")", "{", "$", "out", "=", "$", "this", "->", "render", "(", "$", "vars", ")", ";", "$", "outputFile", "=", "$", "this", "->", "getOutputFile", "(", ")", ";", "$", "destin...
Create static version of a concrete page @param array $vars List of variables passed to template engine @return \Phrozn\Site\View
[ "Create", "static", "version", "of", "a", "concrete", "page" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/Base.php#L126-L144
45,457
Pawka/phrozn
Phrozn/Site/View/Base.php
Base.getOutputFile
public function getOutputFile() { if (!$this->outputFile) { $path = new OutputFile($this); $this->setOutputFile($path->get()); } return $this->outputFile; }
php
public function getOutputFile() { if (!$this->outputFile) { $path = new OutputFile($this); $this->setOutputFile($path->get()); } return $this->outputFile; }
[ "public", "function", "getOutputFile", "(", ")", "{", "if", "(", "!", "$", "this", "->", "outputFile", ")", "{", "$", "path", "=", "new", "OutputFile", "(", "$", "this", ")", ";", "$", "this", "->", "setOutputFile", "(", "$", "path", "->", "get", "...
Get output file path @return string
[ "Get", "output", "file", "path" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/Base.php#L224-L232
45,458
Pawka/phrozn
Phrozn/Site/View/Base.php
Base.getParam
public function getParam($param, $default = null) { try { $this->parse(); $value = $this->getParams($param, null); } catch (\Exception $e) { // skip error on file read problems, just return default value } if (isset($value)) { return $value; } else { return $default; } }
php
public function getParam($param, $default = null) { try { $this->parse(); $value = $this->getParams($param, null); } catch (\Exception $e) { // skip error on file read problems, just return default value } if (isset($value)) { return $value; } else { return $default; } }
[ "public", "function", "getParam", "(", "$", "param", ",", "$", "default", "=", "null", ")", "{", "try", "{", "$", "this", "->", "parse", "(", ")", ";", "$", "value", "=", "$", "this", "->", "getParams", "(", "$", "param", ",", "null", ")", ";", ...
Get param value @param string $param Parameter name to obtain value for @param mixed $default Default parameter value, if non found in FM @return mixed
[ "Get", "param", "value" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/Base.php#L339-L352
45,459
Pawka/phrozn
Phrozn/Site/View/Base.php
Base.getParams
public function getParams($param = null, $default = array()) { $params = array(); $params['page'] = $this->getFrontMatter(); $params['site'] = $this->getSiteConfig(); $params['phr'] = $this->getAppConfig(); $params['current'] = array(); $inputFile = $this->getInputFile(); $pos = strpos($inputFile, '/entries'); if (false !== $pos) { $params['current']['phr_template'] = substr($this->getInputFile(), $pos + 8 + 1); } // also create merged configuration if (isset($params['page'], $params['site'])) { $params['this'] = array_merge($params['page'], $params['site'], $params['current']); } else { $params['this'] = $params['current']; } if (null !== $param) { $params = $this->locateParam($params, $param); } return isset($params) ? $params : $default; }
php
public function getParams($param = null, $default = array()) { $params = array(); $params['page'] = $this->getFrontMatter(); $params['site'] = $this->getSiteConfig(); $params['phr'] = $this->getAppConfig(); $params['current'] = array(); $inputFile = $this->getInputFile(); $pos = strpos($inputFile, '/entries'); if (false !== $pos) { $params['current']['phr_template'] = substr($this->getInputFile(), $pos + 8 + 1); } // also create merged configuration if (isset($params['page'], $params['site'])) { $params['this'] = array_merge($params['page'], $params['site'], $params['current']); } else { $params['this'] = $params['current']; } if (null !== $param) { $params = $this->locateParam($params, $param); } return isset($params) ? $params : $default; }
[ "public", "function", "getParams", "(", "$", "param", "=", "null", ",", "$", "default", "=", "array", "(", ")", ")", "{", "$", "params", "=", "array", "(", ")", ";", "$", "params", "[", "'page'", "]", "=", "$", "this", "->", "getFrontMatter", "(", ...
Get view parameters from both front matter and general site options @param string $param Parameter to get value for. Levels are separated with dots @param string $default Default value to fetch if param is not found @return array
[ "Get", "view", "parameters", "from", "both", "front", "matter", "and", "general", "site", "options" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/Base.php#L362-L388
45,460
Pawka/phrozn
Phrozn/Site/View/Base.php
Base.getFrontMatter
public function getFrontMatter() { if (null === $this->frontMatter) { $this->parse(); } if (null === $this->frontMatter) { $this->frontMatter = array(); } return $this->frontMatter; }
php
public function getFrontMatter() { if (null === $this->frontMatter) { $this->parse(); } if (null === $this->frontMatter) { $this->frontMatter = array(); } return $this->frontMatter; }
[ "public", "function", "getFrontMatter", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "frontMatter", ")", "{", "$", "this", "->", "parse", "(", ")", ";", "}", "if", "(", "null", "===", "$", "this", "->", "frontMatter", ")", "{", "$", ...
Get YAML front matter from input view @return array
[ "Get", "YAML", "front", "matter", "from", "input", "view" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/Base.php#L455-L464
45,461
Pawka/phrozn
Phrozn/Site/View/Base.php
Base.applyLayout
protected function applyLayout($content, $vars) { $layoutName = $this->getParam('page.layout', ViewFactory::DEFAULT_LAYOUT_SCRIPT); $inputFile = $this->getInputFile(); $inputFile = str_replace('\\', '/', $inputFile); $pos = strpos($inputFile, '/entries'); // make sure that input path is normalized to root entries directory if (false !== $pos) { $inputFile = substr($inputFile, 0, $pos + 8) . '/entry'; } $layoutPath = realpath(dirname($inputFile) . '/../layouts/' . $layoutName); $factory = new ViewFactory($layoutPath); $layout = $factory->create(); // essentially layout is Site\View as well $layout->hasLayout(false); // no nested layouts $vars['content'] = $content; $vars['entry'] = $vars['page']; return $layout->render($vars); }
php
protected function applyLayout($content, $vars) { $layoutName = $this->getParam('page.layout', ViewFactory::DEFAULT_LAYOUT_SCRIPT); $inputFile = $this->getInputFile(); $inputFile = str_replace('\\', '/', $inputFile); $pos = strpos($inputFile, '/entries'); // make sure that input path is normalized to root entries directory if (false !== $pos) { $inputFile = substr($inputFile, 0, $pos + 8) . '/entry'; } $layoutPath = realpath(dirname($inputFile) . '/../layouts/' . $layoutName); $factory = new ViewFactory($layoutPath); $layout = $factory->create(); // essentially layout is Site\View as well $layout->hasLayout(false); // no nested layouts $vars['content'] = $content; $vars['entry'] = $vars['page']; return $layout->render($vars); }
[ "protected", "function", "applyLayout", "(", "$", "content", ",", "$", "vars", ")", "{", "$", "layoutName", "=", "$", "this", "->", "getParam", "(", "'page.layout'", ",", "ViewFactory", "::", "DEFAULT_LAYOUT_SCRIPT", ")", ";", "$", "inputFile", "=", "$", "...
Two step view is used. View to wrap is provided with content variable. @param string $content View text to wrap into layout @param array $vars List of variables passed to processors @return string
[ "Two", "step", "view", "is", "used", ".", "View", "to", "wrap", "is", "provided", "with", "content", "variable", "." ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/Base.php#L501-L523
45,462
Pawka/phrozn
Phrozn/Site/View/Base.php
Base.parse
private function parse() { if (isset($this->template, $this->frontMatter)) { return $this; } $source = $this->readSourceFile(); $parts = preg_split('/[\n]*[-]{3}[\n]/', $source, 2); if (count($parts) === 2) { $this->frontMatter = Yaml::parse($parts[0]); $this->template = trim($parts[1]); } else { $this->frontMatter = array(); $this->template = trim($source); } return $this; }
php
private function parse() { if (isset($this->template, $this->frontMatter)) { return $this; } $source = $this->readSourceFile(); $parts = preg_split('/[\n]*[-]{3}[\n]/', $source, 2); if (count($parts) === 2) { $this->frontMatter = Yaml::parse($parts[0]); $this->template = trim($parts[1]); } else { $this->frontMatter = array(); $this->template = trim($source); } return $this; }
[ "private", "function", "parse", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "template", ",", "$", "this", "->", "frontMatter", ")", ")", "{", "return", "$", "this", ";", "}", "$", "source", "=", "$", "this", "->", "readSourceFile", "...
Parses input file into front matter and actual template content @return \Phrozn\Site\View
[ "Parses", "input", "file", "into", "front", "matter", "and", "actual", "template", "content" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/Base.php#L546-L564
45,463
Pawka/phrozn
Phrozn/Site/View/Base.php
Base.readSourceFile
private function readSourceFile() { if (null == $this->source) { $path = $this->getInputFile(); if (null === $path) { throw new \RuntimeException("View input file not specified."); } try { $this->source = \file_get_contents($path); } catch (\Exception $e) { throw new \RuntimeException(sprintf('View "%s" file can not be read', $path)); } } return $this->source; }
php
private function readSourceFile() { if (null == $this->source) { $path = $this->getInputFile(); if (null === $path) { throw new \RuntimeException("View input file not specified."); } try { $this->source = \file_get_contents($path); } catch (\Exception $e) { throw new \RuntimeException(sprintf('View "%s" file can not be read', $path)); } } return $this->source; }
[ "private", "function", "readSourceFile", "(", ")", "{", "if", "(", "null", "==", "$", "this", "->", "source", ")", "{", "$", "path", "=", "$", "this", "->", "getInputFile", "(", ")", ";", "if", "(", "null", "===", "$", "path", ")", "{", "throw", ...
Read input file @return string
[ "Read", "input", "file" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/Base.php#L571-L585
45,464
Pawka/phrozn
Phrozn/Site/View/Less.php
Less.setInputFile
public function setInputFile($path) { parent::setInputFile($path); $processors = $this->getProcessors(); if (count($processors)) { $options = array( 'phr_template_filename' => basename($path), 'phr_template_dir' => dirname($path), ); $processor = array_pop($processors); $processor->setConfig($options); } return $this; }
php
public function setInputFile($path) { parent::setInputFile($path); $processors = $this->getProcessors(); if (count($processors)) { $options = array( 'phr_template_filename' => basename($path), 'phr_template_dir' => dirname($path), ); $processor = array_pop($processors); $processor->setConfig($options); } return $this; }
[ "public", "function", "setInputFile", "(", "$", "path", ")", "{", "parent", "::", "setInputFile", "(", "$", "path", ")", ";", "$", "processors", "=", "$", "this", "->", "getProcessors", "(", ")", ";", "if", "(", "count", "(", "$", "processors", ")", ...
Set input file path. Overriden to update processor options. @param string $file Path to file @return \Phrozn\Site\View
[ "Set", "input", "file", "path", ".", "Overriden", "to", "update", "processor", "options", "." ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/Less.php#L66-L79
45,465
Pawka/phrozn
Phrozn/Runner/CommandLine/Callback/Base.php
Base.readLine
public function readLine() { if (null !== $this->unitTestData) { return $this->unitTestData; } else { $outputter = new PlainOutputter(); $reader = new Reader(); return $reader ->setOutputter($outputter) ->readLine("Type 'yes' to continue: "); } }
php
public function readLine() { if (null !== $this->unitTestData) { return $this->unitTestData; } else { $outputter = new PlainOutputter(); $reader = new Reader(); return $reader ->setOutputter($outputter) ->readLine("Type 'yes' to continue: "); } }
[ "public", "function", "readLine", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "unitTestData", ")", "{", "return", "$", "this", "->", "unitTestData", ";", "}", "else", "{", "$", "outputter", "=", "new", "PlainOutputter", "(", ")", ";", ...
Read-line either from STDIN or mock unit test data @return string
[ "Read", "-", "line", "either", "from", "STDIN", "or", "mock", "unit", "test", "data" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Runner/CommandLine/Callback/Base.php#L177-L188
45,466
Pawka/phrozn
Phrozn/Runner/CommandLine/Callback/Base.php
Base.getRealCommandName
private function getRealCommandName($file) { $iter = CommandLine\Commands::getInstance(); $commands = array(); foreach ($iter as $name => $data) { $commands[$name] = $data; } ksort($commands); if (!file_exists($file)) { foreach ($commands as $command) { if (is_array($command["command"]["aliases"]) && in_array($file, $command["command"]["aliases"])) { return $command["command"]["name"]; } } } return $file; }
php
private function getRealCommandName($file) { $iter = CommandLine\Commands::getInstance(); $commands = array(); foreach ($iter as $name => $data) { $commands[$name] = $data; } ksort($commands); if (!file_exists($file)) { foreach ($commands as $command) { if (is_array($command["command"]["aliases"]) && in_array($file, $command["command"]["aliases"])) { return $command["command"]["name"]; } } } return $file; }
[ "private", "function", "getRealCommandName", "(", "$", "file", ")", "{", "$", "iter", "=", "CommandLine", "\\", "Commands", "::", "getInstance", "(", ")", ";", "$", "commands", "=", "array", "(", ")", ";", "foreach", "(", "$", "iter", "as", "$", "name"...
Search if an alias exists for this command @param string $file Command name (could be an alias) @return string The real command file name
[ "Search", "if", "an", "alias", "exists", "for", "this", "command" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Runner/CommandLine/Callback/Base.php#L210-L228
45,467
Pawka/phrozn
Phrozn/Runner/CommandLine/Callback/Base.php
Base.combine
protected function combine($file, $verbose = false) { $file = $this->getRealCommandName($file); $config = $this->getConfig(); $file = $config['paths']['configs'] . 'commands/' . $file . '.yml'; $data = Yaml::parse($file); if ($data === $file) { return false; } $docs = $data['docs']; $command = $data['command']; $out = ''; $out .= sprintf("%s: %s\n", $docs['name'], $docs['summary']); $out .= 'usage: ' . trim($docs['usage']) . "\n"; $out .= "\n " . $this->pre($docs['description']) . "\n"; $hasOptions = false; if (isset($command['options']) && count($command['options'])) { $out .= "Available options:\n"; foreach ($command['options'] as $opt) { $spaces = str_repeat(' ', 30 - strlen($opt['doc_name'])); $out .= " {$opt['doc_name']} {$spaces} : {$opt['description']}\n"; } $hasOptions = true; } if (isset($command['arguments']) && count($command['arguments'])) { $out .= $hasOptions ? "\n": ""; $out .= "Valid arguments:\n"; foreach ($command['arguments'] as $arg) { $spaces = str_repeat(' ', 30 - strlen($arg['help_name'])); $out .= " {$arg['help_name']} {$spaces} : {$arg['description']}\n"; } } if (isset($command['commands']) && count($command['commands'])) { $out .= "Valid commands:\n"; foreach ($command['commands'] as $subcommand) { $spaces = str_repeat(' ', 30 - strlen($subcommand['name'])); $out .= " {$subcommand['name']} {$spaces} : {$subcommand['description']}\n"; } } if ($verbose) { if (isset($docs['extradesc'])) { $out .= "\nExtended Documentation:"; $out .= "\n " . $this->pre(trim($docs['extradesc'])) . "\n"; } if (isset($docs['examples'])) { $out .= "\nExamples:"; $out .= "\n " . $this->pre(trim($docs['examples'])) . "\n"; } } else { $out .= "\nUse help with -v or --verbose option to get more information.\n"; } return $out; }
php
protected function combine($file, $verbose = false) { $file = $this->getRealCommandName($file); $config = $this->getConfig(); $file = $config['paths']['configs'] . 'commands/' . $file . '.yml'; $data = Yaml::parse($file); if ($data === $file) { return false; } $docs = $data['docs']; $command = $data['command']; $out = ''; $out .= sprintf("%s: %s\n", $docs['name'], $docs['summary']); $out .= 'usage: ' . trim($docs['usage']) . "\n"; $out .= "\n " . $this->pre($docs['description']) . "\n"; $hasOptions = false; if (isset($command['options']) && count($command['options'])) { $out .= "Available options:\n"; foreach ($command['options'] as $opt) { $spaces = str_repeat(' ', 30 - strlen($opt['doc_name'])); $out .= " {$opt['doc_name']} {$spaces} : {$opt['description']}\n"; } $hasOptions = true; } if (isset($command['arguments']) && count($command['arguments'])) { $out .= $hasOptions ? "\n": ""; $out .= "Valid arguments:\n"; foreach ($command['arguments'] as $arg) { $spaces = str_repeat(' ', 30 - strlen($arg['help_name'])); $out .= " {$arg['help_name']} {$spaces} : {$arg['description']}\n"; } } if (isset($command['commands']) && count($command['commands'])) { $out .= "Valid commands:\n"; foreach ($command['commands'] as $subcommand) { $spaces = str_repeat(' ', 30 - strlen($subcommand['name'])); $out .= " {$subcommand['name']} {$spaces} : {$subcommand['description']}\n"; } } if ($verbose) { if (isset($docs['extradesc'])) { $out .= "\nExtended Documentation:"; $out .= "\n " . $this->pre(trim($docs['extradesc'])) . "\n"; } if (isset($docs['examples'])) { $out .= "\nExamples:"; $out .= "\n " . $this->pre(trim($docs['examples'])) . "\n"; } } else { $out .= "\nUse help with -v or --verbose option to get more information.\n"; } return $out; }
[ "protected", "function", "combine", "(", "$", "file", ",", "$", "verbose", "=", "false", ")", "{", "$", "file", "=", "$", "this", "->", "getRealCommandName", "(", "$", "file", ")", ";", "$", "config", "=", "$", "this", "->", "getConfig", "(", ")", ...
Combine command documentation @param string $file Command file to combine @param boolean $verbose Whether to provide full documentation or just summary @return string
[ "Combine", "command", "documentation" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Runner/CommandLine/Callback/Base.php#L238-L299
45,468
Pawka/phrozn
Phrozn/Runner/CommandLine/Callback/Base.php
Base.getPathArgument
protected function getPathArgument($name, $realpath = true, $command = null) { if (null == $command) { $command = $this->getParseResult()->command; } $path = isset($command->args[$name]) ? $command->args[$name] : \getcwd(); if (!$this->isAbsolute($path)) { // not an absolute path $path = \getcwd() . '/./' . $path; } if ($realpath) { $path = realpath($path); } return $path; }
php
protected function getPathArgument($name, $realpath = true, $command = null) { if (null == $command) { $command = $this->getParseResult()->command; } $path = isset($command->args[$name]) ? $command->args[$name] : \getcwd(); if (!$this->isAbsolute($path)) { // not an absolute path $path = \getcwd() . '/./' . $path; } if ($realpath) { $path = realpath($path); } return $path; }
[ "protected", "function", "getPathArgument", "(", "$", "name", ",", "$", "realpath", "=", "true", ",", "$", "command", "=", "null", ")", "{", "if", "(", "null", "==", "$", "command", ")", "{", "$", "command", "=", "$", "this", "->", "getParseResult", ...
Extract path argument or fallback to cwd @param string $name Name of the path argument @param boolean $realpath Whether to apply realpath() to path @param \Console_CommandLine_Result $command Command line result to use @return string
[ "Extract", "path", "argument", "or", "fallback", "to", "cwd" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Runner/CommandLine/Callback/Base.php#L369-L385
45,469
Pawka/phrozn
Phrozn/Autoloader.php
Autoloader.getLoader
public function getLoader() { if (null === $this->loader) { if (strpos('@PHP-BIN@', '@PHP-BIN') === 0) { $base = dirname(__FILE__) . '/'; set_include_path($base . PATH_SEPARATOR . get_include_path()); } else { $base = '@PEAR-DIR@/Phrozn/'; } //Autoload candidates. $dirs = array($base . '..', getcwd()); foreach ($dirs as $dir) { $file = $dir . '/vendor/autoload.php'; if (file_exists($file)) { $this->loader = include $file; break; } } if (null === $this->loader) { throw new \RuntimeException("Unable to locate autoloader."); } } return $this->loader; }
php
public function getLoader() { if (null === $this->loader) { if (strpos('@PHP-BIN@', '@PHP-BIN') === 0) { $base = dirname(__FILE__) . '/'; set_include_path($base . PATH_SEPARATOR . get_include_path()); } else { $base = '@PEAR-DIR@/Phrozn/'; } //Autoload candidates. $dirs = array($base . '..', getcwd()); foreach ($dirs as $dir) { $file = $dir . '/vendor/autoload.php'; if (file_exists($file)) { $this->loader = include $file; break; } } if (null === $this->loader) { throw new \RuntimeException("Unable to locate autoloader."); } } return $this->loader; }
[ "public", "function", "getLoader", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "loader", ")", "{", "if", "(", "strpos", "(", "'@PHP-BIN@'", ",", "'@PHP-BIN'", ")", "===", "0", ")", "{", "$", "base", "=", "dirname", "(", "__FILE__", ...
Get auto-loader instance @return \Composer\Autoload\ClassLoader
[ "Get", "auto", "-", "loader", "instance" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Autoloader.php#L62-L89
45,470
Pawka/phrozn
Phrozn/Autoloader.php
Autoloader.getPaths
public function getPaths() { if (strpos('@PHP-BIN@', '@PHP-BIN') === 0) { $dataDir = dirname(__FILE__) . '/../'; $phpDir = dirname(__FILE__) . '/'; } else { $dataDir = '@DATA-DIR@/Phrozn/'; $phpDir = '@PEAR-DIR@/Phrozn/'; } return array( 'data_dir' => $dataDir, 'php_dir' => $phpDir, 'configs' => $dataDir . 'configs/', 'skeleton' => $dataDir . 'skeleton/', 'library' => $phpDir, ); }
php
public function getPaths() { if (strpos('@PHP-BIN@', '@PHP-BIN') === 0) { $dataDir = dirname(__FILE__) . '/../'; $phpDir = dirname(__FILE__) . '/'; } else { $dataDir = '@DATA-DIR@/Phrozn/'; $phpDir = '@PEAR-DIR@/Phrozn/'; } return array( 'data_dir' => $dataDir, 'php_dir' => $phpDir, 'configs' => $dataDir . 'configs/', 'skeleton' => $dataDir . 'skeleton/', 'library' => $phpDir, ); }
[ "public", "function", "getPaths", "(", ")", "{", "if", "(", "strpos", "(", "'@PHP-BIN@'", ",", "'@PHP-BIN'", ")", "===", "0", ")", "{", "$", "dataDir", "=", "dirname", "(", "__FILE__", ")", ".", "'/../'", ";", "$", "phpDir", "=", "dirname", "(", "__F...
Get base paths required to load extra resources @return array
[ "Get", "base", "paths", "required", "to", "load", "extra", "resources" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Autoloader.php#L96-L112
45,471
Pawka/phrozn
Phrozn/Site/Base.php
Base.getOutputDir
public function getOutputDir() { // override output directory using site config file $config = $this->getSiteConfig(); if (isset($config['site']['output'])) { $this->setOutputDir($config['site']['output']); } return $this->outputDir; }
php
public function getOutputDir() { // override output directory using site config file $config = $this->getSiteConfig(); if (isset($config['site']['output'])) { $this->setOutputDir($config['site']['output']); } return $this->outputDir; }
[ "public", "function", "getOutputDir", "(", ")", "{", "// override output directory using site config file", "$", "config", "=", "$", "this", "->", "getSiteConfig", "(", ")", ";", "if", "(", "isset", "(", "$", "config", "[", "'site'", "]", "[", "'output'", "]",...
Get output directory path @return string
[ "Get", "output", "directory", "path" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/Base.php#L125-L133
45,472
Pawka/phrozn
Phrozn/Site/Base.php
Base.getSiteConfig
public function getSiteConfig() { if (null === $this->siteConfig) { $configFile = realpath($this->getInputDir() . '/config.yml'); $this->siteConfig = Yaml::parse($configFile); } return $this->siteConfig; }
php
public function getSiteConfig() { if (null === $this->siteConfig) { $configFile = realpath($this->getInputDir() . '/config.yml'); $this->siteConfig = Yaml::parse($configFile); } return $this->siteConfig; }
[ "public", "function", "getSiteConfig", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "siteConfig", ")", "{", "$", "configFile", "=", "realpath", "(", "$", "this", "->", "getInputDir", "(", ")", ".", "'/config.yml'", ")", ";", "$", "this",...
Get site configuration @return array
[ "Get", "site", "configuration" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/Base.php#L200-L207
45,473
Pawka/phrozn
Phrozn/Site/Base.php
Base.buildQueue
protected function buildQueue() { // guess the base path with Phrozn project $projectDir = $this->getProjectDir(); $outputDir = $this->getOutputDir(); $config = $this->getSiteConfig(); // configure skip files options $skipToken = '-!SKIP!-'; $folders = array( 'entries', 'styles', 'scripts' ); foreach ($folders as $folder) { $dir = new \RecursiveDirectoryIterator($projectDir . '/' . $folder); $it = new \RecursiveIteratorIterator($dir, \RecursiveIteratorIterator::SELF_FIRST); foreach ($it as $item) { $baseName = $item->getBaseName(); if (isset($config['skip'])) { $baseName = preg_replace($config['skip'], array_fill(0, count($config['skip']), $skipToken), $baseName); if (strpos($baseName, $skipToken) !== false) { continue; } } if ($item->isFile()) { try { $factory = new View\Factory($item->getRealPath()); $factory->setInputRootDir($projectDir); $view = $factory->create(); $view ->setSiteConfig($this->getSiteConfig()) ->setOutputDir($outputDir); $this->views[] = $view; } catch (\Exception $e) { $this->getOutputter() ->stderr(str_replace($projectDir, '', $item->getRealPath()) . ': ' . $e->getMessage()); } } } } return $this; }
php
protected function buildQueue() { // guess the base path with Phrozn project $projectDir = $this->getProjectDir(); $outputDir = $this->getOutputDir(); $config = $this->getSiteConfig(); // configure skip files options $skipToken = '-!SKIP!-'; $folders = array( 'entries', 'styles', 'scripts' ); foreach ($folders as $folder) { $dir = new \RecursiveDirectoryIterator($projectDir . '/' . $folder); $it = new \RecursiveIteratorIterator($dir, \RecursiveIteratorIterator::SELF_FIRST); foreach ($it as $item) { $baseName = $item->getBaseName(); if (isset($config['skip'])) { $baseName = preg_replace($config['skip'], array_fill(0, count($config['skip']), $skipToken), $baseName); if (strpos($baseName, $skipToken) !== false) { continue; } } if ($item->isFile()) { try { $factory = new View\Factory($item->getRealPath()); $factory->setInputRootDir($projectDir); $view = $factory->create(); $view ->setSiteConfig($this->getSiteConfig()) ->setOutputDir($outputDir); $this->views[] = $view; } catch (\Exception $e) { $this->getOutputter() ->stderr(str_replace($projectDir, '', $item->getRealPath()) . ': ' . $e->getMessage()); } } } } return $this; }
[ "protected", "function", "buildQueue", "(", ")", "{", "// guess the base path with Phrozn project", "$", "projectDir", "=", "$", "this", "->", "getProjectDir", "(", ")", ";", "$", "outputDir", "=", "$", "this", "->", "getOutputDir", "(", ")", ";", "$", "config...
Create list of views to be created @return \Phrozn\Site
[ "Create", "list", "of", "views", "to", "be", "created" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/Base.php#L214-L256
45,474
Pawka/phrozn
Phrozn/Site/Base.php
Base.getProjectDir
protected function getProjectDir() { $dir = rtrim($this->getInputDir(), '/'); if (is_dir($dir . '/.phrozn')) { $dir .= '/.phrozn/'; } // see if we have entries folder present if (!is_dir($dir . '/entries')) { throw new \RuntimeException('Entries folder not found'); } return $dir; }
php
protected function getProjectDir() { $dir = rtrim($this->getInputDir(), '/'); if (is_dir($dir . '/.phrozn')) { $dir .= '/.phrozn/'; } // see if we have entries folder present if (!is_dir($dir . '/entries')) { throw new \RuntimeException('Entries folder not found'); } return $dir; }
[ "protected", "function", "getProjectDir", "(", ")", "{", "$", "dir", "=", "rtrim", "(", "$", "this", "->", "getInputDir", "(", ")", ",", "'/'", ")", ";", "if", "(", "is_dir", "(", "$", "dir", ".", "'/.phrozn'", ")", ")", "{", "$", "dir", ".=", "'...
Guess directory with Phrozn project using input directory @return string
[ "Guess", "directory", "with", "Phrozn", "project", "using", "input", "directory" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/Base.php#L263-L276
45,475
Pawka/phrozn
Phrozn/Provider/Factory.php
Factory.create
public function create($type, $data) { // try to see if we have user defined plugin $class = 'PhroznPlugin\\Provider\\' . ucfirst($type); if (!class_exists($class)) { $class = 'Phrozn\\Provider\\' . ucfirst($type); if (!class_exists($class)) { throw new \RuntimeException("Provider of type '{$type}' not found.."); } } $object = new $class; $object->setConfig($data); return $object; }
php
public function create($type, $data) { // try to see if we have user defined plugin $class = 'PhroznPlugin\\Provider\\' . ucfirst($type); if (!class_exists($class)) { $class = 'Phrozn\\Provider\\' . ucfirst($type); if (!class_exists($class)) { throw new \RuntimeException("Provider of type '{$type}' not found.."); } } $object = new $class; $object->setConfig($data); return $object; }
[ "public", "function", "create", "(", "$", "type", ",", "$", "data", ")", "{", "// try to see if we have user defined plugin", "$", "class", "=", "'PhroznPlugin\\\\Provider\\\\'", ".", "ucfirst", "(", "$", "type", ")", ";", "if", "(", "!", "class_exists", "(", ...
Create provider instance @param string $type Provider typ to initialize @param mixed $data Provider data return \Phrozn\Provider
[ "Create", "provider", "instance" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Provider/Factory.php#L41-L54
45,476
Pawka/phrozn
Phrozn/Runner/CommandLine/Parser.php
Parser.configureCommand
private function configureCommand($paths, $config) { // options foreach ($config['command']['options'] as $name => $option) { $this->addOption($name, $option); } // commands $commands = CommandLine\Commands::getInstance() ->setPath($paths['configs'] . 'commands'); foreach ($commands as $name => $data) { $this->registerCommand($name, $data); } return $this; }
php
private function configureCommand($paths, $config) { // options foreach ($config['command']['options'] as $name => $option) { $this->addOption($name, $option); } // commands $commands = CommandLine\Commands::getInstance() ->setPath($paths['configs'] . 'commands'); foreach ($commands as $name => $data) { $this->registerCommand($name, $data); } return $this; }
[ "private", "function", "configureCommand", "(", "$", "paths", ",", "$", "config", ")", "{", "// options", "foreach", "(", "$", "config", "[", "'command'", "]", "[", "'options'", "]", "as", "$", "name", "=>", "$", "option", ")", "{", "$", "this", "->", ...
Fine tune main command by adding subcommands @para array $paths Paths to various Phrozn directories @param array $config Loaded contents of phrozn.yml @return \Phrozn\Runner\Command
[ "Fine", "tune", "main", "command", "by", "adding", "subcommands" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Runner/CommandLine/Parser.php#L63-L79
45,477
Pawka/phrozn
Phrozn/Runner/CommandLine/Parser.php
Parser.registerCommand
private function registerCommand( $name, $data, \Console_CommandLine_Command $parent = null) { $command = isset($data['command']) ? $data['command'] : $data; if (null === $parent) { $cmd = $this->addCommand($name, $command); } else { $cmd = $parent->addCommand($name, $command); } // command arguments $args = isset($command['arguments']) ? $command['arguments'] : array(); foreach ($args as $name => $argument) { $cmd->addArgument($name, $argument); } // command options $opts = isset($command['options']) ? $command['options'] : array(); foreach ($opts as $name => $option) { $cmd->addOption($name, $option); } // commands actions (sub-commands) $subs = isset($command['commands']) ? $command['commands'] : array(); foreach ($subs as $name => $data) { $this->registerCommand($name, $data, $cmd); } }
php
private function registerCommand( $name, $data, \Console_CommandLine_Command $parent = null) { $command = isset($data['command']) ? $data['command'] : $data; if (null === $parent) { $cmd = $this->addCommand($name, $command); } else { $cmd = $parent->addCommand($name, $command); } // command arguments $args = isset($command['arguments']) ? $command['arguments'] : array(); foreach ($args as $name => $argument) { $cmd->addArgument($name, $argument); } // command options $opts = isset($command['options']) ? $command['options'] : array(); foreach ($opts as $name => $option) { $cmd->addOption($name, $option); } // commands actions (sub-commands) $subs = isset($command['commands']) ? $command['commands'] : array(); foreach ($subs as $name => $data) { $this->registerCommand($name, $data, $cmd); } }
[ "private", "function", "registerCommand", "(", "$", "name", ",", "$", "data", ",", "\\", "Console_CommandLine_Command", "$", "parent", "=", "null", ")", "{", "$", "command", "=", "isset", "(", "$", "data", "[", "'command'", "]", ")", "?", "$", "data", ...
Register given command using array of options @param string $name Command name @param array $data Array of command initializing options @param \Console_CommandLine_Command $parent If sub-command is being added, provide parent @return void
[ "Register", "given", "command", "using", "array", "of", "options" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Runner/CommandLine/Parser.php#L99-L123
45,478
Pawka/phrozn
Phrozn/Site/View/Markdown.php
Markdown.render
public function render($vars = array()) { $view = parent::render($vars); if ($this->hasLayout()) { // inject global site and front matter options into template $vars = array_merge_recursive($vars, $this->getParams()); $view = $this->applyLayout($view, $vars); } return $view; }
php
public function render($vars = array()) { $view = parent::render($vars); if ($this->hasLayout()) { // inject global site and front matter options into template $vars = array_merge_recursive($vars, $this->getParams()); $view = $this->applyLayout($view, $vars); } return $view; }
[ "public", "function", "render", "(", "$", "vars", "=", "array", "(", ")", ")", "{", "$", "view", "=", "parent", "::", "render", "(", "$", "vars", ")", ";", "if", "(", "$", "this", "->", "hasLayout", "(", ")", ")", "{", "// inject global site and fron...
Render view. Markdown views are rendered within layout. @param array $vars List of variables passed to text processors @return string
[ "Render", "view", ".", "Markdown", "views", "are", "rendered", "within", "layout", "." ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/Markdown.php#L59-L68
45,479
Pawka/phrozn
Phrozn/Site/View/OutputPath/Base.php
Base.getInputFileExtension
protected function getInputFileExtension($includeDot = true) { $extension = pathinfo($this->getView()->getInputFile(), PATHINFO_EXTENSION); if ($includeDot && $extension != '') { return '.' . $extension; } return $extension; }
php
protected function getInputFileExtension($includeDot = true) { $extension = pathinfo($this->getView()->getInputFile(), PATHINFO_EXTENSION); if ($includeDot && $extension != '') { return '.' . $extension; } return $extension; }
[ "protected", "function", "getInputFileExtension", "(", "$", "includeDot", "=", "true", ")", "{", "$", "extension", "=", "pathinfo", "(", "$", "this", "->", "getView", "(", ")", "->", "getInputFile", "(", ")", ",", "PATHINFO_EXTENSION", ")", ";", "if", "(",...
Get the file extension for the input file @return string
[ "Get", "the", "file", "extension", "for", "the", "input", "file" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/OutputPath/Base.php#L94-L103
45,480
Pawka/phrozn
Phrozn/Config.php
Config.updatePaths
public function updatePaths() { if (isset($this->configs['paths'])) { $paths = Loader::getInstance()->getPaths(); foreach ($this->configs['paths'] as $key => $file) { $file = str_replace('@PEAR-DIR@', $paths['php_dir'], $file); $file = str_replace('@DATA-DIR@', $paths['data_dir'], $file); $this->configs['paths'][$key] = $file; } } return $this; }
php
public function updatePaths() { if (isset($this->configs['paths'])) { $paths = Loader::getInstance()->getPaths(); foreach ($this->configs['paths'] as $key => $file) { $file = str_replace('@PEAR-DIR@', $paths['php_dir'], $file); $file = str_replace('@DATA-DIR@', $paths['data_dir'], $file); $this->configs['paths'][$key] = $file; } } return $this; }
[ "public", "function", "updatePaths", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "configs", "[", "'paths'", "]", ")", ")", "{", "$", "paths", "=", "Loader", "::", "getInstance", "(", ")", "->", "getPaths", "(", ")", ";", "foreach", "...
Make sure that absolute application path is prepended to config paths @return \Phrozn\Config
[ "Make", "sure", "that", "absolute", "application", "path", "is", "prepended", "to", "config", "paths" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Config.php#L120-L131
45,481
Pawka/phrozn
Phrozn/Registry/Dao/Base.php
Base.setContainer
public function setContainer(\Phrozn\Registry\Container $container = null) { $this->container = $container; return $this; }
php
public function setContainer(\Phrozn\Registry\Container $container = null) { $this->container = $container; return $this; }
[ "public", "function", "setContainer", "(", "\\", "Phrozn", "\\", "Registry", "\\", "Container", "$", "container", "=", "null", ")", "{", "$", "this", "->", "container", "=", "$", "container", ";", "return", "$", "this", ";", "}" ]
Set registry container. @param \Phrozn\Registry\Container $container Registry container @return \Phrozn\Has\Container
[ "Set", "registry", "container", "." ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Registry/Dao/Base.php#L73-L77
45,482
Pawka/phrozn
Phrozn/Registry/Dao/Base.php
Base.setProjectPath
public function setProjectPath($path) { if (!($path instanceof \Phrozn\Path\Project)) { $path = new ProjectPath($path); } $this->projectPath = $path->get(); // calculate path return $this; }
php
public function setProjectPath($path) { if (!($path instanceof \Phrozn\Path\Project)) { $path = new ProjectPath($path); } $this->projectPath = $path->get(); // calculate path return $this; }
[ "public", "function", "setProjectPath", "(", "$", "path", ")", "{", "if", "(", "!", "(", "$", "path", "instanceof", "\\", "Phrozn", "\\", "Path", "\\", "Project", ")", ")", "{", "$", "path", "=", "new", "ProjectPath", "(", "$", "path", ")", ";", "}...
Set project path. @param string $path Project path. @return \Phrozn\Has\ProjectPath
[ "Set", "project", "path", "." ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Registry/Dao/Base.php#L96-L104
45,483
Pawka/phrozn
Phrozn/Site/View/Factory.php
Factory.create
public function create() { $ext = pathinfo($this->getInputFile(), PATHINFO_EXTENSION); $type = $ext ? : self::DEFAULT_VIEW_TYPE; return $this->constructFile($type); }
php
public function create() { $ext = pathinfo($this->getInputFile(), PATHINFO_EXTENSION); $type = $ext ? : self::DEFAULT_VIEW_TYPE; return $this->constructFile($type); }
[ "public", "function", "create", "(", ")", "{", "$", "ext", "=", "pathinfo", "(", "$", "this", "->", "getInputFile", "(", ")", ",", "PATHINFO_EXTENSION", ")", ";", "$", "type", "=", "$", "ext", "?", ":", "self", "::", "DEFAULT_VIEW_TYPE", ";", "return",...
Depending on internal configuration and concrete type, create view return \Phrozn\Site\View\Factory
[ "Depending", "on", "internal", "configuration", "and", "concrete", "type", "create", "view" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/Factory.php#L75-L82
45,484
Pawka/phrozn
Phrozn/Site/View/Factory.php
Factory.setInputFile
public function setInputFile($path) { if (null !== $path) { if (!is_readable($path)) { throw new \RuntimeException("View source file cannot be read: {$path}"); } $this->inputFile = $path; } return $this; }
php
public function setInputFile($path) { if (null !== $path) { if (!is_readable($path)) { throw new \RuntimeException("View source file cannot be read: {$path}"); } $this->inputFile = $path; } return $this; }
[ "public", "function", "setInputFile", "(", "$", "path", ")", "{", "if", "(", "null", "!==", "$", "path", ")", "{", "if", "(", "!", "is_readable", "(", "$", "path", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "\"View source file cannot b...
Set input file path @param string $path Path to file @return \Phrozn\Site\View\Factory
[ "Set", "input", "file", "path" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/Factory.php#L114-L124
45,485
Pawka/phrozn
Phrozn/Site/View/Factory.php
Factory.constructFile
private function constructFile($type) { // try to see if we have user defined plugin $class = 'PhroznPlugin\\Site\\View\\' . ucfirst($type); if (!class_exists($class)) { $class = 'Phrozn\\Site\\View\\' . ucfirst($type); if (!class_exists($class)) { //throw new \RuntimeException("View of type '{$type}' not found.."); $class = 'Phrozn\\Site\\View\\Plain'; } } $object = new $class; $object->setInputRootDir($this->getInputRootDir()); $object->setInputFile($this->getInputFile()); return $object; }
php
private function constructFile($type) { // try to see if we have user defined plugin $class = 'PhroznPlugin\\Site\\View\\' . ucfirst($type); if (!class_exists($class)) { $class = 'Phrozn\\Site\\View\\' . ucfirst($type); if (!class_exists($class)) { //throw new \RuntimeException("View of type '{$type}' not found.."); $class = 'Phrozn\\Site\\View\\Plain'; } } $object = new $class; $object->setInputRootDir($this->getInputRootDir()); $object->setInputFile($this->getInputFile()); return $object; }
[ "private", "function", "constructFile", "(", "$", "type", ")", "{", "// try to see if we have user defined plugin", "$", "class", "=", "'PhroznPlugin\\\\Site\\\\View\\\\'", ".", "ucfirst", "(", "$", "type", ")", ";", "if", "(", "!", "class_exists", "(", "$", "clas...
Create and return view of a given type @param string $type File type to load @return \Phrozn\Site\View
[ "Create", "and", "return", "view", "of", "a", "given", "type" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Site/View/Factory.php#L143-L158
45,486
Pawka/phrozn
Phrozn/Runner/CommandLine/Commands.php
Commands.getIterator
private function getIterator() { if (null === $this->getPath()) { throw new \RuntimeException('Commands config path not set'); } if (null === $this->it) { $this->it = new \DirectoryIterator($this->getPath()); } return $this->it; }
php
private function getIterator() { if (null === $this->getPath()) { throw new \RuntimeException('Commands config path not set'); } if (null === $this->it) { $this->it = new \DirectoryIterator($this->getPath()); } return $this->it; }
[ "private", "function", "getIterator", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "getPath", "(", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Commands config path not set'", ")", ";", "}", "if", "(", "null", "===", "$"...
Get DirecotryIterator to commands config path @return \DirectoryIterator
[ "Get", "DirecotryIterator", "to", "commands", "config", "path" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Runner/CommandLine/Commands.php#L141-L150
45,487
Pawka/phrozn
Phrozn/Provider/LoadFromFile.php
LoadFromFile.get
public function get() { $config = $this->getConfig(); if (!isset($config['input'])) { throw new \RuntimeException('No input file provided.'); } $path = $this->getProjectPath() . '/' . $config['input']; if (!is_readable($path)) { throw new \RuntimeException(sprintf('Input file "%s" not found.', $path)); } return file_get_contents($path); }
php
public function get() { $config = $this->getConfig(); if (!isset($config['input'])) { throw new \RuntimeException('No input file provided.'); } $path = $this->getProjectPath() . '/' . $config['input']; if (!is_readable($path)) { throw new \RuntimeException(sprintf('Input file "%s" not found.', $path)); } return file_get_contents($path); }
[ "public", "function", "get", "(", ")", "{", "$", "config", "=", "$", "this", "->", "getConfig", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "config", "[", "'input'", "]", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'No inpu...
Get generated content @return mixed
[ "Get", "generated", "content" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Provider/LoadFromFile.php#L39-L50
45,488
Pawka/phrozn
Phrozn/Runner/CommandLine/Reader.php
Reader.readLine
public function readLine($prompt) { $this ->getOutputter() ->stdout($prompt); $out = fgets($this->getHandle()); $this->getOutputter()->stdout("\n"); return rtrim($out); }
php
public function readLine($prompt) { $this ->getOutputter() ->stdout($prompt); $out = fgets($this->getHandle()); $this->getOutputter()->stdout("\n"); return rtrim($out); }
[ "public", "function", "readLine", "(", "$", "prompt", ")", "{", "$", "this", "->", "getOutputter", "(", ")", "->", "stdout", "(", "$", "prompt", ")", ";", "$", "out", "=", "fgets", "(", "$", "this", "->", "getHandle", "(", ")", ")", ";", "$", "th...
Get line from standard input @param string $prompt Input prompt @return string
[ "Get", "line", "from", "standard", "input" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Runner/CommandLine/Reader.php#L85-L93
45,489
Pawka/phrozn
Phrozn/Registry/Container.php
Container.setDao
public function setDao(\Phrozn\Registry\Dao $dao) { $this->dao = $dao; if ($dao instanceof Dao) { $dao->setContainer($this); } return $this; }
php
public function setDao(\Phrozn\Registry\Dao $dao) { $this->dao = $dao; if ($dao instanceof Dao) { $dao->setContainer($this); } return $this; }
[ "public", "function", "setDao", "(", "\\", "Phrozn", "\\", "Registry", "\\", "Dao", "$", "dao", ")", "{", "$", "this", "->", "dao", "=", "$", "dao", ";", "if", "(", "$", "dao", "instanceof", "Dao", ")", "{", "$", "dao", "->", "setContainer", "(", ...
Set DAO. @param \Phrozn\Registry\Dao $dao Data access object @return \Phrozn\Has\Dao
[ "Set", "DAO", "." ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Registry/Container.php#L104-L111
45,490
Pawka/phrozn
Phrozn/Registry/Container.php
Container.get
public function get($name) { if (!isset($this->values[$name])) { return null; } return $this->values[$name]; }
php
public function get($name) { if (!isset($this->values[$name])) { return null; } return $this->values[$name]; }
[ "public", "function", "get", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "values", "[", "$", "name", "]", ")", ")", "{", "return", "null", ";", "}", "return", "$", "this", "->", "values", "[", "$", "name", "]", ...
Get property value @param string $name Property name @return mixed
[ "Get", "property", "value" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Registry/Container.php#L190-L196
45,491
Pawka/phrozn
Phrozn/Runner/CommandLine.php
CommandLine.parse
private function parse() { $opts = $this->result->options; $commandName = $this->result->command_name; $command = null; $optionSet = $argumentSet = false; // special treatment for -h --help main command options if ($opts['help'] === true) { $commandName = 'help'; } if ($commandName) { $configFile = $this->paths['configs'] . 'commands/' . $commandName . '.yml'; $command = new Command($configFile); } // check if any option is set // basically check for --version -v --help -h options foreach ($opts as $name => $value) { if ($value === true) { $optionSet = true; break; } } // fire up subcommand if (isset($command['callback'])) { $this->invoke($command['callback'], $command); } if ($commandName === false && $optionSet === false && $argumentSet === false) { $this->parser->outputter->stdout("Type 'phrozn help' for usage.\n"); } }
php
private function parse() { $opts = $this->result->options; $commandName = $this->result->command_name; $command = null; $optionSet = $argumentSet = false; // special treatment for -h --help main command options if ($opts['help'] === true) { $commandName = 'help'; } if ($commandName) { $configFile = $this->paths['configs'] . 'commands/' . $commandName . '.yml'; $command = new Command($configFile); } // check if any option is set // basically check for --version -v --help -h options foreach ($opts as $name => $value) { if ($value === true) { $optionSet = true; break; } } // fire up subcommand if (isset($command['callback'])) { $this->invoke($command['callback'], $command); } if ($commandName === false && $optionSet === false && $argumentSet === false) { $this->parser->outputter->stdout("Type 'phrozn help' for usage.\n"); } }
[ "private", "function", "parse", "(", ")", "{", "$", "opts", "=", "$", "this", "->", "result", "->", "options", ";", "$", "commandName", "=", "$", "this", "->", "result", "->", "command_name", ";", "$", "command", "=", "null", ";", "$", "optionSet", "...
Parse input and invoke necessary processor callback @return void
[ "Parse", "input", "and", "invoke", "necessary", "processor", "callback" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Runner/CommandLine.php#L103-L137
45,492
Pawka/phrozn
Phrozn/Vendor/Extra/scss.inc.php
scssc.compileImport
protected function compileImport($rawPath, $out) { if ($rawPath[0] == "string") { $path = $this->compileStringContent($rawPath); if ($path = $this->findImport($path)) { $this->importFile($path, $out); return true; } return false; } if ($rawPath[0] == "list") { // handle a list of strings if (count($rawPath[2]) == 0) return false; foreach ($rawPath[2] as $path) { if ($path[0] != "string") return false; } foreach ($rawPath[2] as $path) { $this->compileImport($path, $out); } return true; } return false; }
php
protected function compileImport($rawPath, $out) { if ($rawPath[0] == "string") { $path = $this->compileStringContent($rawPath); if ($path = $this->findImport($path)) { $this->importFile($path, $out); return true; } return false; } if ($rawPath[0] == "list") { // handle a list of strings if (count($rawPath[2]) == 0) return false; foreach ($rawPath[2] as $path) { if ($path[0] != "string") return false; } foreach ($rawPath[2] as $path) { $this->compileImport($path, $out); } return true; } return false; }
[ "protected", "function", "compileImport", "(", "$", "rawPath", ",", "$", "out", ")", "{", "if", "(", "$", "rawPath", "[", "0", "]", "==", "\"string\"", ")", "{", "$", "path", "=", "$", "this", "->", "compileStringContent", "(", "$", "rawPath", ")", "...
returns true if the value was something that could be imported
[ "returns", "true", "if", "the", "value", "was", "something", "that", "could", "be", "imported" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Vendor/Extra/scss.inc.php#L420-L443
45,493
Pawka/phrozn
Phrozn/Vendor/Extra/scss.inc.php
scssc.normalizeNumber
protected function normalizeNumber($number) { list(, $value, $unit) = $number; if (isset(self::$unitTable["in"][$unit])) { $conv = self::$unitTable["in"][$unit]; return array("number", $value / $conv, "in"); } return $number; }
php
protected function normalizeNumber($number) { list(, $value, $unit) = $number; if (isset(self::$unitTable["in"][$unit])) { $conv = self::$unitTable["in"][$unit]; return array("number", $value / $conv, "in"); } return $number; }
[ "protected", "function", "normalizeNumber", "(", "$", "number", ")", "{", "list", "(", ",", "$", "value", ",", "$", "unit", ")", "=", "$", "number", ";", "if", "(", "isset", "(", "self", "::", "$", "unitTable", "[", "\"in\"", "]", "[", "$", "unit",...
just does physical lengths for now
[ "just", "does", "physical", "lengths", "for", "now" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Vendor/Extra/scss.inc.php#L853-L860
45,494
Pawka/phrozn
Phrozn/Vendor/Extra/scss.inc.php
scssc.extractInterpolation
protected function extractInterpolation($list) { $items = $list[2]; foreach ($items as $i => $item) { if ($item[0] == "interpolate") { $before = array("list", $list[1], array_slice($items, 0, $i)); $after = array("list", $list[1], array_slice($items, $i + 1)); return array("interpolated", $item, $before, $after); } } return $list; }
php
protected function extractInterpolation($list) { $items = $list[2]; foreach ($items as $i => $item) { if ($item[0] == "interpolate") { $before = array("list", $list[1], array_slice($items, 0, $i)); $after = array("list", $list[1], array_slice($items, $i + 1)); return array("interpolated", $item, $before, $after); } } return $list; }
[ "protected", "function", "extractInterpolation", "(", "$", "list", ")", "{", "$", "items", "=", "$", "list", "[", "2", "]", ";", "foreach", "(", "$", "items", "as", "$", "i", "=>", "$", "item", ")", "{", "if", "(", "$", "item", "[", "0", "]", "...
doesn't need to be recursive, compileValue will handle that
[ "doesn", "t", "need", "to", "be", "recursive", "compileValue", "will", "handle", "that" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Vendor/Extra/scss.inc.php#L1092-L1102
45,495
Pawka/phrozn
Phrozn/Vendor/Extra/scss.inc.php
scssc.multiplySelectors
protected function multiplySelectors($env) { $envs = array(); while (null !== $env) { if (!empty($env->selectors)) { $envs[] = $env; } $env = $env->parent; }; $selectors = array(); $parentSelectors = array(array()); while ($env = array_pop($envs)) { $selectors = array(); foreach ($env->selectors as $selector) { foreach ($parentSelectors as $parent) { $selectors[] = $this->joinSelectors($parent, $selector); } } $parentSelectors = $selectors; } return $selectors; }
php
protected function multiplySelectors($env) { $envs = array(); while (null !== $env) { if (!empty($env->selectors)) { $envs[] = $env; } $env = $env->parent; }; $selectors = array(); $parentSelectors = array(array()); while ($env = array_pop($envs)) { $selectors = array(); foreach ($env->selectors as $selector) { foreach ($parentSelectors as $parent) { $selectors[] = $this->joinSelectors($parent, $selector); } } $parentSelectors = $selectors; } return $selectors; }
[ "protected", "function", "multiplySelectors", "(", "$", "env", ")", "{", "$", "envs", "=", "array", "(", ")", ";", "while", "(", "null", "!==", "$", "env", ")", "{", "if", "(", "!", "empty", "(", "$", "env", "->", "selectors", ")", ")", "{", "$",...
find the final set of selectors
[ "find", "the", "final", "set", "of", "selectors" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Vendor/Extra/scss.inc.php#L1105-L1127
45,496
Pawka/phrozn
Phrozn/Vendor/Extra/scss.inc.php
scssc.joinSelectors
protected function joinSelectors($parent, $child) { $setSelf = false; $out = array(); foreach ($child as $part) { $newPart = array(); foreach ($part as $p) { if ($p == self::$selfSelector) { $setSelf = true; foreach ($parent as $i => $parentPart) { if ($i > 0) { $out[] = $newPart; $newPart = array(); } foreach ($parentPart as $pp) { $newPart[] = $pp; } } } else { $newPart[] = $p; } } $out[] = $newPart; } return $setSelf ? $out : array_merge($parent, $child); }
php
protected function joinSelectors($parent, $child) { $setSelf = false; $out = array(); foreach ($child as $part) { $newPart = array(); foreach ($part as $p) { if ($p == self::$selfSelector) { $setSelf = true; foreach ($parent as $i => $parentPart) { if ($i > 0) { $out[] = $newPart; $newPart = array(); } foreach ($parentPart as $pp) { $newPart[] = $pp; } } } else { $newPart[] = $p; } } $out[] = $newPart; } return $setSelf ? $out : array_merge($parent, $child); }
[ "protected", "function", "joinSelectors", "(", "$", "parent", ",", "$", "child", ")", "{", "$", "setSelf", "=", "false", ";", "$", "out", "=", "array", "(", ")", ";", "foreach", "(", "$", "child", "as", "$", "part", ")", "{", "$", "newPart", "=", ...
looks for & to replace, or append parent before child
[ "looks", "for", "&", "to", "replace", "or", "append", "parent", "before", "child" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Vendor/Extra/scss.inc.php#L1130-L1157
45,497
Pawka/phrozn
Phrozn/Vendor/Extra/scss.inc.php
scssc.coerceList
protected function coerceList($item, $delim = ",") { if (!is_null($item) && $item[0] == "list") { return $item; } return array("list", $delim, is_null($item) ? array(): array($item)); }
php
protected function coerceList($item, $delim = ",") { if (!is_null($item) && $item[0] == "list") { return $item; } return array("list", $delim, is_null($item) ? array(): array($item)); }
[ "protected", "function", "coerceList", "(", "$", "item", ",", "$", "delim", "=", "\",\"", ")", "{", "if", "(", "!", "is_null", "(", "$", "item", ")", "&&", "$", "item", "[", "0", "]", "==", "\"list\"", ")", "{", "return", "$", "item", ";", "}", ...
convert something to list
[ "convert", "something", "to", "list" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Vendor/Extra/scss.inc.php#L1189-L1195
45,498
Pawka/phrozn
Phrozn/Vendor/Extra/scss.inc.php
scssc.findImport
protected function findImport($url) { $urls = array(); // for "normal" scss imports (ignore vanilla css and external requests) if (!preg_match('/\.css|^http:\/\/$/', $url)) { // try both normal and the _partial filename $urls = array($url, preg_replace('/[^\/]+$/', '_\0', $url)); } foreach ($this->importPaths as $dir) { if (is_string($dir)) { // check urls for normal import paths foreach ($urls as $full) { $full = $dir . (!empty($dir) && substr($dir, -1) != '/' ? '/' : '') . $full; if ($this->fileExists($file = $full.'.scss') || $this->fileExists($file = $full)) { return $file; } } } else { // check custom callback for import path $file = call_user_func($dir,$url,$this); if ($file !== null) { return $file; } } } return null; }
php
protected function findImport($url) { $urls = array(); // for "normal" scss imports (ignore vanilla css and external requests) if (!preg_match('/\.css|^http:\/\/$/', $url)) { // try both normal and the _partial filename $urls = array($url, preg_replace('/[^\/]+$/', '_\0', $url)); } foreach ($this->importPaths as $dir) { if (is_string($dir)) { // check urls for normal import paths foreach ($urls as $full) { $full = $dir . (!empty($dir) && substr($dir, -1) != '/' ? '/' : '') . $full; if ($this->fileExists($file = $full.'.scss') || $this->fileExists($file = $full)) { return $file; } } } else { // check custom callback for import path $file = call_user_func($dir,$url,$this); if ($file !== null) { return $file; } } } return null; }
[ "protected", "function", "findImport", "(", "$", "url", ")", "{", "$", "urls", "=", "array", "(", ")", ";", "// for \"normal\" scss imports (ignore vanilla css and external requests)", "if", "(", "!", "preg_match", "(", "'/\\.css|^http:\\/\\/$/'", ",", "$", "url", "...
results the file path for an import url if it exists
[ "results", "the", "file", "path", "for", "an", "import", "url", "if", "it", "exists" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Vendor/Extra/scss.inc.php#L1363-L1396
45,499
Pawka/phrozn
Phrozn/Vendor/Extra/scss.inc.php
scssc.toRGB
function toRGB($H, $S, $L) { $H = $H % 360; if ($H < 0) $H += 360; $S = min(100, max(0, $S)); $L = min(100, max(0, $L)); $H = $H / 360; $S = $S / 100; $L = $L / 100; if ($S == 0) { $r = $g = $b = $L; } else { $temp2 = $L < 0.5 ? $L*(1.0 + $S) : $L + $S - $L * $S; $temp1 = 2.0 * $L - $temp2; $r = $this->toRGB_helper($H + 1/3, $temp1, $temp2); $g = $this->toRGB_helper($H, $temp1, $temp2); $b = $this->toRGB_helper($H - 1/3, $temp1, $temp2); } $out = array('color', $r*255, $g*255, $b*255); return $out; }
php
function toRGB($H, $S, $L) { $H = $H % 360; if ($H < 0) $H += 360; $S = min(100, max(0, $S)); $L = min(100, max(0, $L)); $H = $H / 360; $S = $S / 100; $L = $L / 100; if ($S == 0) { $r = $g = $b = $L; } else { $temp2 = $L < 0.5 ? $L*(1.0 + $S) : $L + $S - $L * $S; $temp1 = 2.0 * $L - $temp2; $r = $this->toRGB_helper($H + 1/3, $temp1, $temp2); $g = $this->toRGB_helper($H, $temp1, $temp2); $b = $this->toRGB_helper($H - 1/3, $temp1, $temp2); } $out = array('color', $r*255, $g*255, $b*255); return $out; }
[ "function", "toRGB", "(", "$", "H", ",", "$", "S", ",", "$", "L", ")", "{", "$", "H", "=", "$", "H", "%", "360", ";", "if", "(", "$", "H", "<", "0", ")", "$", "H", "+=", "360", ";", "$", "S", "=", "min", "(", "100", ",", "max", "(", ...
H from 0 to 360, S and L from 0 to 100
[ "H", "from", "0", "to", "360", "S", "and", "L", "from", "0", "to", "100" ]
e46659c281986e5883559e8e2990c86de7484652
https://github.com/Pawka/phrozn/blob/e46659c281986e5883559e8e2990c86de7484652/Phrozn/Vendor/Extra/scss.inc.php#L1596-L1623