_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q238800 | Field.setValue | train | private function setValue($value, $store)
{
if (\in_array($this->attribs['type'], array('checkbox','select'))) {
if (\is_null($value)) {
$value = array();
}
$this->props['values'] = (array) $value;
} else {
$this->attribs['value'] = $va... | php | {
"resource": ""
} |
q238801 | Field.val | train | public function val($val = null, $store = true)
{
if (\func_num_args()) {
// setting
$this->setValue($val, $store);
} else {
if ($this->props['getValFormatted'] && !\in_array('getValFormatted', $this->callStack)) {
$this->callStack[] = 'getValForma... | php | {
"resource": ""
} |
q238802 | Field.validateCrs | train | protected function validateCrs()
{
$nonEmpty = array();
$enabled = array();
$required = array();
$optsValid = array();
foreach ($this->props['options'] as $opt) {
if (empty($opt['attribs']['disabled']) && !isset($opt['optgroup'])) {
$enable... | php | {
"resource": ""
} |
q238803 | AbstractCrudController.read | train | public function read($id)
{
$class = $this->getEntityClassFromType($this->apiRecordType);
$entity = $this->getEntityManager()->find($class, $id);
if (!$entity) {
return new Response('', Response::HTTP_NOT_FOUND);
}
return new JsonResponse($this->getApiWriter()->... | php | {
"resource": ""
} |
q238804 | TS3WA_Module.getTS3Connection | train | protected function getTS3Connection()
{
$serverqry = TeamSpeak3_Helper_Uri::getSessParam("_serverqry");
if(!$serverqry)
{
throw new Exception("TeamSpeak3_Node_Abstract object does not exist in your current session");
}
$this->ts3 = unserialize($serverqry);
} | php | {
"resource": ""
} |
q238805 | TS3WA_Module.assignLastEvent | train | protected function assignLastEvent()
{
$this->tpl->assign("eventMesg", TeamSpeak3_Helper_Uri::getSessParam("_eventmesg"));
$this->tpl->assign("eventType", TeamSpeak3_Helper_Uri::getSessParam("_eventtype", "user"));
unset($_SESSION["_eventmesg"]);
unset($_SESSION["_eventtype"]);
} | php | {
"resource": ""
} |
q238806 | TS3WA_Module.redirect | train | protected function redirect($module, $action = "index", $params = array())
{
$module = $this->app->getModuleKey() . "=" . $module;
$action = $action != "index" ? '&' . $this->app->getActionKey() . "=" . $action : "";
foreach($params as $key => $val)
{
$action .= "&" . $key . "=" . $val;
}
... | php | {
"resource": ""
} |
q238807 | TS3WA_Module.dispatch | train | public function dispatch()
{
$moduleName = $this->app->getModuleName();
$actionName = $this->app->getActionName();
$layoutFile = $moduleName . ($actionName != "index" ? "_" . $actionName : "") . ".tpl.php";
$this->tpl->render($layoutFile);
} | php | {
"resource": ""
} |
q238808 | Stream.error | train | public function error($str, $status = 1, $new_line = true)
{
fwrite($this->error, $str.( true===$new_line ? PHP_EOL : '' ));
fflush($this->error);
if ($status>0) exit($status);
} | php | {
"resource": ""
} |
q238809 | Stream.write | train | public function write($str, $new_line = true)
{
fwrite($this->stream, $str.( true===$new_line ? PHP_EOL : '' ));
fflush($this->stream);
} | php | {
"resource": ""
} |
q238810 | Stream.prompt | train | public function prompt($str)
{
self::write( $str, false );
$this->user_response = trim( fgets( $this->input, 4096 ) );
} | php | {
"resource": ""
} |
q238811 | JavascriptRenderer.renderElement | train | protected function renderElement(ElementInterface $element)
{
$collection = $this->getAttributesCollection($element);
$this->addElementChildren($element, $collection);
$this->addElementDependencies($element, $collection);
$this->addElementRules($element, $collection);
retur... | php | {
"resource": ""
} |
q238812 | JavascriptRenderer.addElementChildren | train | protected function addElementChildren(ElementInterface $element, AttributeCollection $collection)
{
$children = $element->getChildren();
if ($children->count()) {
$attribute = new Attribute('aoFields', $this->renderChildren($children), Attribute::TYPE_ARRAY);
$collection->add... | php | {
"resource": ""
} |
q238813 | JavascriptRenderer.addElementDependencies | train | protected function addElementDependencies(ElementInterface $element, AttributeCollection $collection)
{
if ($element->hasOption('dependencies') && count($element->getOption('dependencies'))) {
$dependencies = $this->formatter->formatDependencies($element->getOption('dependencies'));
... | php | {
"resource": ""
} |
q238814 | JavascriptRenderer.addElementRules | train | protected function addElementRules(ElementInterface $element, AttributeCollection $collection)
{
if ($element->hasOption('rules') && count($element->getOption('rules'))) {
$rules = $this->formatter->formatRules($element->getOption('rules'));
$collection->add(new Attribute('aoRules', ... | php | {
"resource": ""
} |
q238815 | JavascriptRenderer.getAttributesCollection | train | protected function getAttributesCollection(ElementInterface $element) : AttributeCollection
{
$collection = new AttributeCollection();
$element->prepareAttributesCollection($collection);
return $collection;
} | php | {
"resource": ""
} |
q238816 | JavascriptRenderer.renderChildren | train | protected function renderChildren(ElementCollection $children)
{
$attributes = [];
$children->forAll(function (ElementInterface $child) use (&$attributes) {
$attributes[] = $this->renderElement($child);
});
return $attributes;
} | php | {
"resource": ""
} |
q238817 | iauFw2m.Fw2m | train | public static function Fw2m($gamb, $phib, $psi, $eps, array &$r) {
/* Construct the matrix. */
IAU::Ir($r);
IAU::Rz($gamb, $r);
IAU::Rx($phib, $r);
IAU::Rz(-$psi, $r);
IAU::Rx(-$eps, $r);
return;
} | php | {
"resource": ""
} |
q238818 | Facade.getFacadeRoot | train | public static function getFacadeRoot() {
$accessor = static::getFacadeAccessor();
$instance = Application::getInstance()->make($accessor);
if ($instance == null) {
throw new Exception('Facade get null for: '.$accessor);
}
return $instance;
} | php | {
"resource": ""
} |
q238819 | PhpErrorException.recover | train | public function recover()
{
// handle the error based on the config and the environment we're in
if (static::$count <= Config::get('errors.throttle', 10))
{
logger(\Fuel::L_ERROR, $this->code.' - '.$this->message.' in '.$this->file.' on line '.$this->line);
if (\Fuel::$env != \Fuel::PRODUCTION and ($this-... | php | {
"resource": ""
} |
q238820 | Error.shutdown_handler | train | public static function shutdown_handler()
{
$last_error = error_get_last();
// Only show valid fatal errors
if ($last_error AND in_array($last_error['type'], static::$fatal_levels))
{
$severity = static::$levels[$last_error['type']];
logger(\Fuel::L_ERROR, $severity.' - '.$last_error['message'].' in '.$... | php | {
"resource": ""
} |
q238821 | Error.exception_handler | train | public static function exception_handler(\Exception $e)
{
if (method_exists($e, 'handle'))
{
return $e->handle();
}
$severity = ( ! isset(static::$levels[$e->getCode()])) ? $e->getCode() : static::$levels[$e->getCode()];
logger(\Fuel::L_ERROR, $severity.' - '.$e->getMessage().' in '.$e->getFile().' on li... | php | {
"resource": ""
} |
q238822 | Error.error_handler | train | public static function error_handler($severity, $message, $filepath, $line)
{
// don't do anything if error reporting is disabled
if (error_reporting() !== 0)
{
$fatal = (bool)( ! in_array($severity, \Config::get('errors.continue_on', array())));
if ($fatal)
{
throw new \PhpErrorException($message,... | php | {
"resource": ""
} |
q238823 | Error.show_php_error | train | public static function show_php_error(\Exception $e)
{
$fatal = (bool)( ! in_array($e->getCode(), \Config::get('errors.continue_on', array())));
$data = static::prepare_exception($e, $fatal);
if ($fatal)
{
$data['contents'] = ob_get_contents();
while (ob_get_level() > 0)
{
ob_end_clean();
}
... | php | {
"resource": ""
} |
q238824 | Error.notice | train | public static function notice($msg, $always_show = false)
{
$trace = array_merge(array('file' => '(unknown)', 'line' => '(unknown)'), \Arr::get(debug_backtrace(), 1));
logger(\Fuel::L_DEBUG, 'Notice - '.$msg.' in '.$trace['file'].' on line '.$trace['line']);
if (\Fuel::$is_test or ( ! $always_show and (\Fuel::$... | php | {
"resource": ""
} |
q238825 | JsonRpcClientContext.userWithPass | train | public function userWithPass($username, $password)
{
$header = base64_encode(sprintf('%s:%s', $username, $password));
$this->headers['Authorization'] = 'Basic ' . $header;
} | php | {
"resource": ""
} |
q238826 | JsonRpcClientContext.responseIsSuccessfully | train | public function responseIsSuccessfully()
{
Assertions::assertEquals(200, $this->response->getStatusCode(), sprintf(
'Response with error "%s".',
$this->response->getBody()
));
Assertions::assertNull($this->response->getRpcErrorCode(), sprintf(
'Response w... | php | {
"resource": ""
} |
q238827 | JsonRpcClientContext.responseIsSuccessfullyWithContainScalarResult | train | public function responseIsSuccessfullyWithContainScalarResult($result)
{
Assertions::assertEquals(200, $this->response->getStatusCode(), sprintf(
'Response with error "%s"',
$this->response->getBody()
));
Assertions::assertTrue(is_null($this->response->getRpcErrorCod... | php | {
"resource": ""
} |
q238828 | JsonRpcClientContext.responseIsSuccessfullyWithContainListResult | train | public function responseIsSuccessfullyWithContainListResult(TableNode $table, $count = null)
{
$this->responseIsSuccessfully();
$rpcResult = $this->response->getRpcResult();
Assertions::assertTrue(is_array($rpcResult), sprintf(
'The RPC response must be a array, but "%s" given.... | php | {
"resource": ""
} |
q238829 | JsonRpcClientContext.iSendARequest | train | public function iSendARequest($method, TableNode $params)
{
$id = $this->getRequestId() ? $this->getRequestId() : uniqid();
$params = $params->getRowsHash();
$requestParameters = [];
foreach ($params as $parameterKey => $parameterValue) {
$property = new PropertyPath($p... | php | {
"resource": ""
} |
q238830 | JsonRpcClientContext.theServerShouldReturnStatusCode | train | public function theServerShouldReturnStatusCode($status)
{
Assertions::assertNotNull($this->response, 'Missing response. Can you not send request?');
Assertions::assertEquals($status, $this->response->getStatusCode(), 'Invalid HTTP status code.');
} | php | {
"resource": ""
} |
q238831 | JsonRpcClientContext.theServerShouldReturnHeaders | train | public function theServerShouldReturnHeaders(TableNode $headers)
{
Assertions::assertNotNull($this->response, 'Missing response. Can you not send request?');
$responseHeaders = [];
foreach ($this->response->getHeaders() as $name => $value) {
$responseHeaders[strtolower($name)] =... | php | {
"resource": ""
} |
q238832 | JsonRpcClientContext.theResponseShouldContainErrorWithMessage | train | public function theResponseShouldContainErrorWithMessage($id, $message)
{
Assertions::assertEquals(intval($id), $this->response->getRpcErrorCode());
Assertions::assertEquals($message, $this->response->getRpcErrorMessage());
} | php | {
"resource": ""
} |
q238833 | JsonRpcClientContext.theResponseShouldContainErrorData | train | public function theResponseShouldContainErrorData($id, $message, TableNode $table)
{
Assertions::assertEquals(200, $this->response->getStatusCode());
$this->theResponseShouldContainErrorWithMessage($id, $message);
$error = $this->getFieldFromBody('error', $this->response->getBody());
... | php | {
"resource": ""
} |
q238834 | JsonRpcClientContext.getFieldFromBody | train | protected function getFieldFromBody($key, $body)
{
$rpc = json_decode($body, true);
return isset($rpc[$key]) ? $rpc[$key] : null;
} | php | {
"resource": ""
} |
q238835 | UserbaseJwtAuthenticatorClient.authenticate | train | public function authenticate($username, $password)
{
$authRequest = new Request('GET', $this->userbaseUrl);
$client = new GuzzleClient(
[
'verify' => $this->tlsCertVerification,
'headers' => [
'User-Agent' => 'HubUserbaseClient (Guzzle)... | php | {
"resource": ""
} |
q238836 | PagesController.reorderPages | train | public function reorderPages()
{
if (!$this->request->isAll(['ajax', 'post'])) {
throw new MethodNotAllowedException();
}
if (empty($this->request->data)) {
throw new BadRequestException();
}
$this->request->data = Hash::map($this->request->data, '{n... | php | {
"resource": ""
} |
q238837 | AdminStockChangeLogController.indexAction | train | public function indexAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$qb = $em->getRepository(StockChangeLog::class)->createQueryBuilder('s');
$this->addQueryBuilderSort($qb, 'stockchangelog');
$paginator = $this->get('knp_paginator')->paginate($qb, $request->que... | php | {
"resource": ""
} |
q238838 | AdminStockChangeLogController.showAction | train | public function showAction(StockChangeLog $stockchangelog)
{
$editForm = $this->createForm(new StockChangeLogType(), $stockchangelog, array(
'action' => $this->generateUrl('admin_shop_changelog_update', array('id' => $stockchangelog->getid())),
'method' => 'PUT',
));
... | php | {
"resource": ""
} |
q238839 | AdminStockChangeLogController.newAction | train | public function newAction()
{
$stockchangelog = new StockChangeLog();
$form = $this->createForm(new StockChangeLogType(), $stockchangelog);
return array(
'stockchangelog' => $stockchangelog,
'form' => $form->createView(),
);
} | php | {
"resource": ""
} |
q238840 | AdminStockChangeLogController.createAction | train | public function createAction(Request $request)
{
$stockchangelog = new StockChangeLog();
$form = $this->createForm(new StockChangeLogType(), $stockchangelog);
if ($form->handleRequest($request)->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($stoc... | php | {
"resource": ""
} |
q238841 | AdminStockChangeLogController.updateAction | train | public function updateAction(StockChangeLog $stockchangelog, Request $request)
{
$editForm = $this->createForm(new StockChangeLogType(), $stockchangelog, array(
'action' => $this->generateUrl('admin_shop_changelog_update', array('id' => $stockchangelog->getid())),
'method' => 'PUT',
... | php | {
"resource": ""
} |
q238842 | iauAtciqn.Atciqn | train | public static function Atciqn($rc, $dc, $pr, $pd, $px, $rv,
iauASTROM &$astrom, $n, array $b, &$ri, &$di) {
foreach ($b as $i)
if ($i instanceof iauLDBODY == false)
throw new \InvalidArgumentException("All \$b elements must be iauLDBODY type");
$pco = [];
$pnat = [];
$ppr = [... | php | {
"resource": ""
} |
q238843 | Form.getTag | train | public function getTag($tag)
{
return isset($this->tags[$tag]) ? $this->tags[$tag] : null;
} | php | {
"resource": ""
} |
q238844 | Form.setHeader | train | public function setHeader($action, $method = 'POST', array $attributes = array())
{
$this->setAction($action);
$this->setMethod($method);
$this->setAttributes($attributes);
return $this;
} | php | {
"resource": ""
} |
q238845 | Form.header | train | public function header()
{
$attributes = array('action' => $this->action, 'method' => $this->method);
$attributes = array_merge($attributes, $this->attributes);
return Html::openTag('form', $attributes);
} | php | {
"resource": ""
} |
q238846 | Form.render | train | public function render(RendererInterface $renderer = null)
{
$renderer = $renderer ?: $this->getDefaultRenderer();
$form = $this->header();
foreach ($this->rows as $row) {
$form .= $row->render($renderer);
}
$form .= '</form>';
return $form;
} | php | {
"resource": ""
} |
q238847 | Form.row | train | public function row($name, RendererInterface $renderer = null)
{
$renderer = $renderer ?: $this->getDefaultRenderer();
return $this->getRow($name)->render($renderer);
} | php | {
"resource": ""
} |
q238848 | Form.input | train | public function input($name, RendererInterface $renderer = null)
{
$renderer = $renderer ?: $this->getDefaultRenderer();
return $this->getRow($name)->input($renderer);
} | php | {
"resource": ""
} |
q238849 | Form.setValues | train | public function setValues(array $values = array(), $ignore_unknown = false)
{
foreach ($values as $name => $value) {
try {
$this->getRow($name)->setValue($value);
} catch (\InvalidArgumentException $e) {
if (!$ignore_unknown) {
thro... | php | {
"resource": ""
} |
q238850 | Form.getValues | train | public function getValues()
{
$values = array();
foreach ($this->rows as $name => $row) {
$values[$name] = $row->getValue();
}
return $values;
} | php | {
"resource": ""
} |
q238851 | Form.buildValidator | train | public function buildValidator()
{
if ($this->validator_built) {
return $this->validator;
}
foreach ($this->rows as $name => $row) {
foreach ($row->getRules() as $rule) {
$this->validator->addRule($name, $rule);
}
$row->disable... | php | {
"resource": ""
} |
q238852 | Form.flattenArray | train | protected function flattenArray(array $values, $previous = '')
{
$result = array();
foreach ($values as $key => $value) {
if ($previous) {
$key = $previous.'['.$key.']';
}
if (is_array($value)) {
$result = $result + $this->flattenAr... | php | {
"resource": ""
} |
q238853 | PhpFpm.getServiceData | train | public function getServiceData($snmpConnection) {
$phpFpmData = $snmpConnection->realWalkToArray('NET-SNMP-EXTEND-MIB::nsExtendOutLine."Php-Fpm"', true);
$return = Array();
$return['num_listen_queue'] = $phpFpmData[1];
$return['num_accepted_connections'] = $phpFpmData[... | php | {
"resource": ""
} |
q238854 | BannerFormFactory.create | train | public function create(BannerInterface $banner)
{
return $this->formFactory->create(
'silvestra_banner',
$banner,
array('action' => $this->router->getContext()->getPathInfo())
);
} | php | {
"resource": ""
} |
q238855 | Environment.init | train | public static function init($build_options)
{
self::$variables_def = $build_options;
foreach ($build_options as $name => $def) {
// if there isn't a defined default value,
// let's defining an empty string as default value
if (!isset($def[1])) {
s... | php | {
"resource": ""
} |
q238856 | Value.isEmpty | train | public function isEmpty(): bool
{
return $this->isNull()
|| (is_array($this->value) && count($this->value) === 0)
|| (is_string($this->value) && strlen($this->value) === 0);
} | php | {
"resource": ""
} |
q238857 | Value.containsAnyOf | train | public function containsAnyOf(array $elements): bool
{
if (!is_scalar($this->value) || null === $this->value) {
return false;
}
foreach ($elements as $needle) {
if (is_bool($needle) && $this->value === $needle) {
return true;
} elseif (!is... | php | {
"resource": ""
} |
q238858 | Value.isOneOf | train | public function isOneOf(array $allowedValues, bool $strict = false): bool
{
if (!is_array($this->value)) {
return in_array($this->value, $allowedValues, $strict);
}
foreach ($this->value as $value) {
if (!in_array($value, $allowedValues, $strict)) {
r... | php | {
"resource": ""
} |
q238859 | Value.defineCheck | train | public static function defineCheck(string $method, callable $function)
{
if (function_exists($method)) {
throw new \InvalidArgumentException('Can not overwrite internal PHP function ' . $method . '().');
}
self::$checks[$method] = $function;
} | php | {
"resource": ""
} |
q238860 | iauObl06.Obl06 | train | public static function Obl06($date1, $date2) {
$t;
$eps0;
/* Interval between fundamental date J2000.0 and given date (JC). */
$t = (($date1 - DJ00) + $date2) / DJC;
/* Mean obliquity. */
$eps0 = (84381.406 +
(-46.836769 +
( -0.0001831 +
( 0.00200340 +
... | php | {
"resource": ""
} |
q238861 | MakeRepositoryCommand.createService | train | protected function createService($name)
{
$name = $this->configureName('service', $name);
if($this->serviceNameExists($name) === true) {
return $this->error('Service already exists');
}
$this->createServiceDirectory();
$this->createBaseServiceAbstract();
... | php | {
"resource": ""
} |
q238862 | MakeRepositoryCommand.createBaseServiceAbstract | train | protected function createBaseServiceAbstract()
{
if( ! $this->files->exists($this->getServiceDirectory() . 'BaseServiceAbstract.php')) {
$stub = str_replace(
['{{ServiceDirectory}}'],
$this->getServiceDirectoryFromConfig(),
$this->files->get(__DIR_... | php | {
"resource": ""
} |
q238863 | MakeRepositoryCommand.createBaseInterfaceFile | train | protected function createBaseInterfaceFile()
{
if( ! $this->files->exists($this->getRepositoryDirectory() . 'BaseRepositoryInterface.php')) {
$stub = str_replace(
['{{Namespace}}'],
$this->getRepositoryDirectoryFromConfig(),
$this->files->get(__DIR... | php | {
"resource": ""
} |
q238864 | MakeRepositoryCommand.createServiceFile | train | protected function createServiceFile($name, $with_interface)
{
$dir_option = rtrim(str_replace('/', '\\', $this->getDirOption()), '/\\');
$dir_option = $dir_option ? '\\' . $dir_option : '';
$classname = $this->configureName('service', $name);
if($with_interface === true) {
... | php | {
"resource": ""
} |
q238865 | MakeRepositoryCommand.createInterfaceFile | train | protected function createInterfaceFile($interface)
{
$dir_option = rtrim(str_replace('/', '\\', $this->getDirOption()), '/\\');
$dir_option = $dir_option ? '\\' . $dir_option : '';
$interface = $this->configureName('repository', $interface);
dd($interface);
$stub = str_repla... | php | {
"resource": ""
} |
q238866 | MakeRepositoryCommand.createTraitFile | train | protected function createTraitFile($trait)
{
$dir_option = rtrim(str_replace('/', '\\', $this->getDirOption()), '/\\');
$dir_option = $dir_option ? '\\' . $dir_option : '';
$trait = $this->configureName('trait', $trait);
$stub = str_replace(
['{{Namespace}}', '{{TraitNam... | php | {
"resource": ""
} |
q238867 | MakeRepositoryCommand.serviceNameExists | train | protected function serviceNameExists($name)
{
if($this->files->exists($this->getServiceDirectory() . $this->getDirOption() . $name . '.php')) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q238868 | MakeRepositoryCommand.repositoryNameExists | train | protected function repositoryNameExists($interface)
{
if($this->files->exists($this->getRepositoryDirectory() . $this->getDirOption() . $interface . 'php')) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q238869 | MakeRepositoryCommand.traitNameExists | train | protected function traitNameExists($trait)
{
if($this->files->exists($this->getTraitDirectory() . $this->getDirOption() . $trait . '.php')) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q238870 | MakeRepositoryCommand.getServiceDirectory | train | protected function getServiceDirectory()
{
if($config = $this->configFileMissing()) {
return $this->error($config);
}
return 'app/' . rtrim($this->getConfigServiceDirectory(), '/\\') . '/';
} | php | {
"resource": ""
} |
q238871 | MakeRepositoryCommand.getRepositoryDirectory | train | protected function getRepositoryDirectory()
{
if($config = $this->configFileMissing()) {
return $this->error($config);
}
return 'app/' . rtrim($this->getConfigRepositoryDirectory(), '/\\') . '/';
} | php | {
"resource": ""
} |
q238872 | MakeRepositoryCommand.getTraitDirectory | train | protected function getTraitDirectory()
{
if($config = $this->configFileMissing()) {
return $this->error($config);
}
return 'app/' . rtrim($this->getConfigTraitDirectory(), '/\\') . '/';
} | php | {
"resource": ""
} |
q238873 | MakeRepositoryCommand.getDirOption | train | protected function getDirOption($return_array = false)
{
if($dir = $this->option('dir')) {
$directories = explode('/', $dir);
if(is_array($directories) && $directories) {
$directories = array_map(function($directory) {
return ucfirst(str::plural(st... | php | {
"resource": ""
} |
q238874 | MakeRepositoryCommand.configureName | train | protected function configureName($type, $name)
{
$config = $this->laravel['config']['repository'];
if($config["{$type}_to_plural"] === true) {
$name = Str::plural($name);
}
if($config["case_sensitive"] === false) {
$name = Str::studly(strtolower($name));
... | php | {
"resource": ""
} |
q238875 | MakeRepositoryCommand.createTraitDirectory | train | protected function createTraitDirectory()
{
if( ! $this->files->isDirectory($this->getTraitDirectory())) {
$this->files->makeDirectory($this->getTraitDirectory());
}
$this->createDirectory('trait');
} | php | {
"resource": ""
} |
q238876 | MakeRepositoryCommand.createInterfaceDirectory | train | protected function createInterfaceDirectory()
{
if( ! $this->files->isDirectory($this->getRepositoryDirectory())) {
$this->files->makeDirectory($this->getRepositoryDirectory());
}
$this->createDirectory('repository');
} | php | {
"resource": ""
} |
q238877 | MakeRepositoryCommand.createServiceDirectory | train | protected function createServiceDirectory()
{
if( ! $this->files->isDirectory($this->getServiceDirectory())) {
$this->files->makeDirectory($this->getServiceDirectory());
}
$this->createDirectory('service');
} | php | {
"resource": ""
} |
q238878 | RouteRegister.getAttributes | train | protected function getAttributes(array $merge = [])
{
return array_merge([
'prefix' => $this->prefix,
'as' => $this->routeName,
'middleware' => $this->middlewares,
'namespace' => $this->namespace,
], $merge);
} | php | {
"resource": ""
} |
q238879 | RouteRegister.loadAttributes | train | protected function loadAttributes($key, array $default = [])
{
$attributes = config($key, $default);
if (isset($attributes['prefix']))
$this->addPrefix($attributes['prefix']);
if (isset($attributes['namespace']))
$this->setNamespace($attributes['namespace']);
... | php | {
"resource": ""
} |
q238880 | DocitController.document | train | public function document($projectSlug, $ref = null, $path = '')
{
$project = $this->factory->getProject($projectSlug);
if (is_null($ref)) {
$ref = $project->getDefaultRef();
}
$project->setRef($ref);
$document = $project->getDocument($path);
$content ... | php | {
"resource": ""
} |
q238881 | InputFactory.setSource | train | public static function setSource($source = null)
{
if (! is_resource($source) && ! is_null($source)) {
throw new InvalidArgumentException(sprintf(
'Invalid source provided; must be a null or an resource, "%s" given.',
is_object($source) ? get_class($source) : gett... | php | {
"resource": ""
} |
q238882 | InputFactory.make | train | public static function make()
{
$stream = new Stream();
$source = static::getSource();
$stream->copy($source);
if (! static::$source) {
fclose($source);
}
return $stream;
} | php | {
"resource": ""
} |
q238883 | Result.getOutput | train | public function getOutput(string $glue = null)
{
if (!is_null($glue)) {
return implode($glue, $this->output);
}
return $this->output;
} | php | {
"resource": ""
} |
q238884 | Result.getOutputLine | train | public function getOutputLine(int $line): string
{
return array_key_exists($line, $this->output) ? $this->output[$line] : null;
} | php | {
"resource": ""
} |
q238885 | Result.setParsed | train | public function setParsed(bool $parsed = true): Result
{
$this->parsed = (boolean) $parsed;
return $this;
} | php | {
"resource": ""
} |
q238886 | Request.forge | train | public static function forge($uri = null, $options = true, $method = null)
{
is_bool($options) and $options = array('route' => $options);
is_string($options) and $options = array('driver' => $options);
if ( ! empty($options['driver']))
{
$class = \Inflector::words_to_upper('Request_'.$options['driver']);
... | php | {
"resource": ""
} |
q238887 | Request.reset_request | train | public static function reset_request($full = false)
{
// Let's make the previous Request active since we are done executing this one.
static::$active and static::$active = static::$active->parent();
if ($full)
{
static::$main = null;
}
} | php | {
"resource": ""
} |
q238888 | Request.param | train | public function param($param, $default = null)
{
if ( ! isset($this->named_params[$param]))
{
return \Fuel::value($default);
}
return $this->named_params[$param];
} | php | {
"resource": ""
} |
q238889 | Cell.getClasses | train | public function getClasses()
{
$classes = [];
$sizes = $this->sizes;
if (isset($sizes['phone'])) {
$classes[] = 'col-xs-' . $sizes['phone'];
}
if (isset($sizes['tablet'])) {
$classes[] = 'col-sm-' . $sizes['tablet'];
}
if (isset($sizes[... | php | {
"resource": ""
} |
q238890 | Cell.getSizes | train | public function getSizes()
{
$sizes = [];
if ($this->phoneSize === 'auto') {
$sizes['phone'] = $this->generatePhoneSize();
} elseif ($this->phoneSize === true && $this->hasPhoneColumns) {
$sizes['phone'] = $this->phoneColumns;
}
if ($this->tabletSize =... | php | {
"resource": ""
} |
q238891 | Cell.getMaxColumns | train | public function getMaxColumns($size = null)
{
if (is_object($this->content) && property_exists($this->content, 'maxColumns') && !is_null($this->content->maxColumns)) {
return $this->content->maxColumns;
}
if (is_null($size)) {
$size = $this->baseSize;
}
... | php | {
"resource": ""
} |
q238892 | Cell.setMaxColumns | train | public function setMaxColumns($columns, $size = null)
{
if (is_null($size)) {
$size = $this->baseSize;
}
$columnAttribute = 'max' . ucfirst($size) . 'Columns';
$this->{$columnAttribute} = $columns;
} | php | {
"resource": ""
} |
q238893 | Cell.getFlex | train | public function getFlex($size = null)
{
if (is_null($size)) {
$size = $this->baseSize;
}
$getter = $size . 'Columns';
$flex = $this->getMaxColumns($size) - $this->{$getter};
if ($flex < 0) {
return 0;
}
return $flex;
} | php | {
"resource": ""
} |
q238894 | Html.open | train | public static function open($tag, array $options = [], $self = false)
{
$attributes = self::attributes($options);
//add the opened tag to $opened array
if (!$self || is_null($self)) {
self::$opened[] = $tag;
//
return '<'.$tag.$attributes.'>';
} e... | php | {
"resource": ""
} |
q238895 | Html.close | train | public static function close()
{
//get the last opened tag
$tag = self::$opened[count(self::$opened) - 1];
//remove the last opened tag
array_pop(self::$opened);
return '</'.$tag.'>';
} | php | {
"resource": ""
} |
q238896 | Html.title | train | public static function title($title = null)
{
if (is_null($title)) {
$title = config('app.title');
}
$tag = static::open('title');
$tag .= $title;
$tag .= static::close();
return $tag;
} | php | {
"resource": ""
} |
q238897 | InsertBuilder._prepareColumns | train | private function _prepareColumns(array $columnArray)
{
if(count($columnArray) === 0)
{
throw new \Exception('The column method of the statement must called before!');
}
foreach($columnArray as $column)
{
$this->columns .= $column->getColumnName() . ', ';
}
$this->columns = rtrim($this->columns);
... | php | {
"resource": ""
} |
q238898 | InsertBuilder._prepareValues | train | private function _prepareValues(array $valueArrays)
{
if(count($valueArrays) === 0)
{
throw new \Exception('The value method of the statement must called before!');
}
foreach($valueArrays as $valueArray)
{
$valueString = '(';
foreach($valueArray as $value)
{
$valueString .= $value->getValue()... | php | {
"resource": ""
} |
q238899 | ScriptHandler.importRoutes | train | public static function importRoutes(Event $event) {
$options = self::getOptions($event);
$appDir = $options['symfony-app-dir'];
$webDir = $options['symfony-web-dir'];
if (!is_dir($webDir)) {
echo 'The symfony-web-dir (' . $webDir . ') specified in composer.json was not found... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.