sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function readDescriptor() { $this->getByte(9); $GIF_screen = $this->GIF_buffer; $GIF_colorF = $this->GIF_buffer[8] & 0x80 ? 1 : 0; if ($GIF_colorF) { $GIF_code = $this->GIF_buffer[8] & 0x07; $GIF_sort = $this->GIF_buffer[8] & 0x20 ? 1 : 0; } else { $GIF_code = $this->GIF_colorC; $GIF_sort = $this->GIF_sorted; } $GIF_size = 2 << $GIF_code; $this->GIF_screen[4] &= 0x70; $this->GIF_screen[4] |= 0x80; $this->GIF_screen[4] |= $GIF_code; if ($GIF_sort) { $this->GIF_screen[4] |= 0x08; } $this->GIF_string = "GIF87a"; $this->putByte($this->GIF_screen); if (1 == $GIF_colorF) { $this->getByte(3 * $GIF_size); $this->putByte($this->GIF_buffer); } else { $this->putByte($this->GIF_global); } $this->GIF_string .= chr(0x2C); $GIF_screen[8] &= 0x40; $this->putByte($GIF_screen); $this->getByte(1); $this->putByte($this->GIF_buffer); for (; ;) { $this->getByte(1); $this->putByte($this->GIF_buffer); if (($u = $this->GIF_buffer[0]) == 0x00) { break; } $this->getByte($u); $this->putByte($this->GIF_buffer); } $this->GIF_string .= chr(0x3B); /* Add frames into $GIF_stream array... */ $this->GIF_arrays[] = $this->GIF_string; }
/* ::::::::::::::::::::::::::::::::::::::::::::::::::: :: :: GIFReadExtension ( ) ::
entailment
public function putByte($bytes) { for ($i = 0; $i < count($bytes); $i++) { $this->GIF_string .= chr($bytes[$i]); } }
/* ::::::::::::::::::::::::::::::::::::::::::::::::::: :: :: GIFPutByte ( $bytes ) ::
entailment
public function addHeader() { if (ord($this->BUF[0]{10}) & 0x80) { $cmap = 3 * (2 << (ord($this->BUF[0]{10}) & 0x07)); $this->GIF .= substr($this->BUF[0], 6, 7); $this->GIF .= substr($this->BUF[0], 13, $cmap); $this->GIF .= "!\377\13NETSCAPE2.0\3\1" . $this->word($this->LOP) . "\0"; } }
/* ::::::::::::::::::::::::::::::::::::::::::::::::::: :: :: GIFAddHeader... ::
entailment
public function blockCompare($GlobalBlock, $LocalBlock, $Len) { for ($i = 0; $i < $Len; $i++) { if ( $GlobalBlock{3 * $i + 0} != $LocalBlock{3 * $i + 0} || $GlobalBlock{3 * $i + 1} != $LocalBlock{3 * $i + 1} || $GlobalBlock{3 * $i + 2} != $LocalBlock{3 * $i + 2} ) { return (0); } } return (1); }
/* ::::::::::::::::::::::::::::::::::::::::::::::::::: :: :: GIFBlockCompare... ::
entailment
public static function open($file) { if (is_string($file)) { $file = new \SplFileInfo($file); } if (!$file->isFile()) { throw new ImageException('image file not exist'); } return new self($file); }
打开一个图片文件 @param \SplFileInfo|string $file @return Image
entailment
public function save($pathname, $type = null, $quality = 80, $interlace = true) { //自动获取图像类型 if (is_null($type)) { $type = $this->info['type']; } else { $type = strtolower($type); } //保存图像 if ('jpeg' == $type || 'jpg' == $type) { //JPEG图像设置隔行扫描 imageinterlace($this->im, $interlace); imagejpeg($this->im, $pathname, $quality); } elseif ('gif' == $type && !empty($this->gif)) { $this->gif->save($pathname); } elseif ('png' == $type) { //设定保存完整的 alpha 通道信息 imagesavealpha($this->im, true); //ImagePNG生成图像的质量范围从0到9的 imagepng($this->im, $pathname, min((int) ($quality / 10), 9)); } else { $fun = 'image' . $type; $fun($this->im, $pathname); } return $this; }
保存图像 @param string $pathname 图像保存路径名称 @param null|string $type 图像类型 @param int $quality 图像质量 @param bool $interlace 是否对JPEG类型图像设置隔行扫描 @return $this
entailment
public function rotate($degrees = 90) { do { $img = imagerotate($this->im, -$degrees, imagecolorallocatealpha($this->im, 0, 0, 0, 127)); imagedestroy($this->im); $this->im = $img; } while (!empty($this->gif) && $this->gifNext()); $this->info['width'] = imagesx($this->im); $this->info['height'] = imagesy($this->im); return $this; }
旋转图像 @param int $degrees 顺时针旋转的度数 @return $this
entailment
public function flip($direction = self::FLIP_X) { //原图宽度和高度 $w = $this->info['width']; $h = $this->info['height']; do { $img = imagecreatetruecolor($w, $h); switch ($direction) { case self::FLIP_X: for ($y = 0; $y < $h; $y++) { imagecopy($img, $this->im, 0, $h - $y - 1, 0, $y, $w, 1); } break; case self::FLIP_Y: for ($x = 0; $x < $w; $x++) { imagecopy($img, $this->im, $w - $x - 1, 0, $x, 0, 1, $h); } break; default: throw new ImageException('不支持的翻转类型'); } imagedestroy($this->im); $this->im = $img; } while (!empty($this->gif) && $this->gifNext()); return $this; }
翻转图像 @param integer $direction 翻转轴,X或者Y @return $this
entailment
public function crop($w, $h, $x = 0, $y = 0, $width = null, $height = null) { //设置保存尺寸 empty($width) && $width = $w; empty($height) && $height = $h; do { //创建新图像 $img = imagecreatetruecolor($width, $height); // 调整默认颜色 $color = imagecolorallocate($img, 255, 255, 255); imagefill($img, 0, 0, $color); //裁剪 imagecopyresampled($img, $this->im, 0, 0, $x, $y, $width, $height, $w, $h); imagedestroy($this->im); //销毁原图 //设置新图像 $this->im = $img; } while (!empty($this->gif) && $this->gifNext()); $this->info['width'] = (int) $width; $this->info['height'] = (int) $height; return $this; }
裁剪图像 @param integer $w 裁剪区域宽度 @param integer $h 裁剪区域高度 @param integer $x 裁剪区域x坐标 @param integer $y 裁剪区域y坐标 @param integer $width 图像保存宽度 @param integer $height 图像保存高度 @return $this
entailment
public function thumb($width, $height, $type = self::THUMB_SCALING) { //原图宽度和高度 $w = $this->info['width']; $h = $this->info['height']; /* 计算缩略图生成的必要参数 */ switch ($type) { /* 等比例缩放 */ case self::THUMB_SCALING: //原图尺寸小于缩略图尺寸则不进行缩略 if ($w < $width && $h < $height) { return $this; } //计算缩放比例 $scale = min($width / $w, $height / $h); //设置缩略图的坐标及宽度和高度 $x = $y = 0; $width = $w * $scale; $height = $h * $scale; break; /* 居中裁剪 */ case self::THUMB_CENTER: //计算缩放比例 $scale = max($width / $w, $height / $h); //设置缩略图的坐标及宽度和高度 $w = $width / $scale; $h = $height / $scale; $x = ($this->info['width'] - $w) / 2; $y = ($this->info['height'] - $h) / 2; break; /* 左上角裁剪 */ case self::THUMB_NORTHWEST: //计算缩放比例 $scale = max($width / $w, $height / $h); //设置缩略图的坐标及宽度和高度 $x = $y = 0; $w = $width / $scale; $h = $height / $scale; break; /* 右下角裁剪 */ case self::THUMB_SOUTHEAST: //计算缩放比例 $scale = max($width / $w, $height / $h); //设置缩略图的坐标及宽度和高度 $w = $width / $scale; $h = $height / $scale; $x = $this->info['width'] - $w; $y = $this->info['height'] - $h; break; /* 填充 */ case self::THUMB_FILLED: //计算缩放比例 if ($w < $width && $h < $height) { $scale = 1; } else { $scale = min($width / $w, $height / $h); } //设置缩略图的坐标及宽度和高度 $neww = $w * $scale; $newh = $h * $scale; $x = $this->info['width'] - $w; $y = $this->info['height'] - $h; $posx = ($width - $w * $scale) / 2; $posy = ($height - $h * $scale) / 2; do { //创建新图像 $img = imagecreatetruecolor($width, $height); // 调整默认颜色 $color = imagecolorallocate($img, 255, 255, 255); imagefill($img, 0, 0, $color); //裁剪 imagecopyresampled($img, $this->im, $posx, $posy, $x, $y, $neww, $newh, $w, $h); imagedestroy($this->im); //销毁原图 $this->im = $img; } while (!empty($this->gif) && $this->gifNext()); $this->info['width'] = (int) $width; $this->info['height'] = (int) $height; return $this; /* 固定 */ case self::THUMB_FIXED: $x = $y = 0; break; default: throw new ImageException('不支持的缩略图裁剪类型'); } /* 裁剪图像 */ return $this->crop($w, $h, $x, $y, $width, $height); }
生成缩略图 @param integer $width 缩略图最大宽度 @param integer $height 缩略图最大高度 @param int $type 缩略图裁剪类型 @return $this
entailment
public function water($source, $locate = self::WATER_SOUTHEAST, $alpha = 100) { if (!is_file($source)) { throw new ImageException('水印图像不存在'); } //获取水印图像信息 $info = getimagesize($source); if (false === $info || (IMAGETYPE_GIF === $info[2] && empty($info['bits']))) { throw new ImageException('非法水印文件'); } //创建水印图像资源 $fun = 'imagecreatefrom' . image_type_to_extension($info[2], false); $water = $fun($source); //设定水印图像的混色模式 imagealphablending($water, true); /* 设定水印位置 */ switch ($locate) { /* 右下角水印 */ case self::WATER_SOUTHEAST: $x = $this->info['width'] - $info[0]; $y = $this->info['height'] - $info[1]; break; /* 左下角水印 */ case self::WATER_SOUTHWEST: $x = 0; $y = $this->info['height'] - $info[1]; break; /* 左上角水印 */ case self::WATER_NORTHWEST: $x = $y = 0; break; /* 右上角水印 */ case self::WATER_NORTHEAST: $x = $this->info['width'] - $info[0]; $y = 0; break; /* 居中水印 */ case self::WATER_CENTER: $x = ($this->info['width'] - $info[0]) / 2; $y = ($this->info['height'] - $info[1]) / 2; break; /* 下居中水印 */ case self::WATER_SOUTH: $x = ($this->info['width'] - $info[0]) / 2; $y = $this->info['height'] - $info[1]; break; /* 右居中水印 */ case self::WATER_EAST: $x = $this->info['width'] - $info[0]; $y = ($this->info['height'] - $info[1]) / 2; break; /* 上居中水印 */ case self::WATER_NORTH: $x = ($this->info['width'] - $info[0]) / 2; $y = 0; break; /* 左居中水印 */ case self::WATER_WEST: $x = 0; $y = ($this->info['height'] - $info[1]) / 2; break; default: /* 自定义水印坐标 */ if (is_array($locate)) { list($x, $y) = $locate; } else { throw new ImageException('不支持的水印位置类型'); } } do { //添加水印 $src = imagecreatetruecolor($info[0], $info[1]); // 调整默认颜色 $color = imagecolorallocate($src, 255, 255, 255); imagefill($src, 0, 0, $color); imagecopy($src, $this->im, 0, 0, $x, $y, $info[0], $info[1]); imagecopy($src, $water, 0, 0, 0, 0, $info[0], $info[1]); imagecopymerge($this->im, $src, $x, $y, 0, 0, $info[0], $info[1], $alpha); //销毁临时图片资源 imagedestroy($src); } while (!empty($this->gif) && $this->gifNext()); //销毁水印资源 imagedestroy($water); return $this; }
添加水印 @param string $source 水印图片路径 @param int|array $locate 水印位置 @param int $alpha 透明度 @return $this
entailment
public function text($text, $font, $size, $color = '#00000000', $locate = self::WATER_SOUTHEAST, $offset = 0, $angle = 0) { if (!is_file($font)) { throw new ImageException("不存在的字体文件:{$font}"); } //获取文字信息 $info = imagettfbbox($size, $angle, $font, $text); $minx = min($info[0], $info[2], $info[4], $info[6]); $maxx = max($info[0], $info[2], $info[4], $info[6]); $miny = min($info[1], $info[3], $info[5], $info[7]); $maxy = max($info[1], $info[3], $info[5], $info[7]); /* 计算文字初始坐标和尺寸 */ $x = $minx; $y = abs($miny); $w = $maxx - $minx; $h = $maxy - $miny; /* 设定文字位置 */ switch ($locate) { /* 右下角文字 */ case self::WATER_SOUTHEAST: $x += $this->info['width'] - $w; $y += $this->info['height'] - $h; break; /* 左下角文字 */ case self::WATER_SOUTHWEST: $y += $this->info['height'] - $h; break; /* 左上角文字 */ case self::WATER_NORTHWEST: // 起始坐标即为左上角坐标,无需调整 break; /* 右上角文字 */ case self::WATER_NORTHEAST: $x += $this->info['width'] - $w; break; /* 居中文字 */ case self::WATER_CENTER: $x += ($this->info['width'] - $w) / 2; $y += ($this->info['height'] - $h) / 2; break; /* 下居中文字 */ case self::WATER_SOUTH: $x += ($this->info['width'] - $w) / 2; $y += $this->info['height'] - $h; break; /* 右居中文字 */ case self::WATER_EAST: $x += $this->info['width'] - $w; $y += ($this->info['height'] - $h) / 2; break; /* 上居中文字 */ case self::WATER_NORTH: $x += ($this->info['width'] - $w) / 2; break; /* 左居中文字 */ case self::WATER_WEST: $y += ($this->info['height'] - $h) / 2; break; default: /* 自定义文字坐标 */ if (is_array($locate)) { list($posx, $posy) = $locate; $x += $posx; $y += $posy; } else { throw new ImageException('不支持的文字位置类型'); } } /* 设置偏移量 */ if (is_array($offset)) { $offset = array_map('intval', $offset); list($ox, $oy) = $offset; } else { $offset = intval($offset); $ox = $oy = $offset; } /* 图片黑白检测 */ if ($color == "auto") { //X方向采集宽度:单英文字符占据宽度约为字体大小/1.6,单中文字符占据宽度约为字体大小*4/3;Y方向采集宽度:英文字符高度约为字体大小,中文会高一些。 //使用保守宽度,以免在纯英文情况下采集区域超出图像范围,并且精度完全可以满足本功能。 $pickX = intval(mb_strwidth($text) * ($size / 1.6)); $pickY = $size; $brightness = 0; for ($i = $x + $ox; $i < $pickX + $x + $ox; $i++) { //根据文字基线确定要进行遍历的像素 for ($j = $y + $oy - $pickY; $j < $y + $oy; $j++) { //基线修正 $brightness += self::getBrightnessOfPixel($i, $j); } } $color = $brightness / ($pickX * $pickY) > 127 ? '#00000000' : '#ffffffff'; } /* 设置颜色 */ if (is_string($color) && 0 === strpos($color, '#')) { $color = str_split(substr($color, 1), 2); $color = array_map('hexdec', $color); if (empty($color[3]) || $color[3] > 127) { $color[3] = 0; } } elseif (!is_array($color)) { throw new ImageException('错误的颜色值'); } do { /* 写入文字 */ $col = imagecolorallocatealpha($this->im, $color[0], $color[1], $color[2], $color[3]); imagettftext($this->im, $size, $angle, $x + $ox, $y + $oy, $col, $font, $text); } while (!empty($this->gif) && $this->gifNext()); return $this; }
图像添加文字 @param string $text 添加的文字 @param string $font 字体路径 @param integer $size 字号 @param string $color 文字颜色 @param int|array $locate 文字写入位置 @param integer $offset 文字相对当前位置的偏移量 @param integer $angle 文字倾斜角度 @return $this @throws ImageException
entailment
private function getBrightnessOfPixel($x, $y) { $rgb = imagecolorat($this->im, $x, $y); $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF; $b = $rgb & 0xFF; //红绿蓝能量不同,亮度不同,对应系数也不同(参考https://www.w3.org/TR/AERT/#color-contrast) $brightness = intval($r * 0.299 + $g * 0.587 + $b * 0.114); return $brightness; }
获取图片指定像素点的亮度值
entailment
public function getCredentials(Request $request) { $url = $this->server_validation_url.'?'.$this->query_ticket_parameter.'='. $request->get($this->query_ticket_parameter).'&'. $this->query_service_parameter.'='.urlencode($this->removeCasTicket($request->getUri())); $client = new Client(); $response = $client->request('GET', $url, $this->options); $string = $response->getBody()->getContents(); $xml = new \SimpleXMLElement($string, 0, false, $this->xml_namespace, true); if (isset($xml->authenticationSuccess)) { return (array) $xml->authenticationSuccess; } return []; }
{@inheritdoc}
entailment
public function getUser($credentials, UserProviderInterface $userProvider) { if (isset($credentials[$this->username_attribute])) { return $userProvider->loadUserByUsername($credentials[$this->username_attribute]); } else { return null; } }
Calls the UserProvider providing a valid User @param array $credentials @param UserProviderInterface $userProvider @return bool
entailment
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) { // If authentication was successful, redirect to the current URI with // the ticket parameter removed so that it is hidden from end-users. if ($request->query->has($this->query_ticket_parameter)) { return new RedirectResponse($this->removeCasTicket($request->getUri())); } else { return null; } }
Mandatory but not in use in a remote authentication @param Request $request @param TokenInterface $token @param $providerKey @return null
entailment
public function onAuthenticationFailure(Request $request, AuthenticationException $exception) { $data = array( 'message' => strtr($exception->getMessageKey(), $exception->getMessageData()) ); $def_response = new JsonResponse($data, 403); $event = new CASAuthenticationFailureEvent($request,$exception, $def_response); $this->eventDispatcher->dispatch(CASAuthenticationFailureEvent::POST_MESSAGE, $event); return $event->getResponse(); }
Mandatory but not in use in a remote authentication @param Request $request @param AuthenticationException $exception @return JsonResponse
entailment
public function start(Request $request, AuthenticationException $authException = null) { return new RedirectResponse($this->server_login_url.'?'.$this->query_service_parameter.'='.urlencode($request->getUri())); }
Called when authentication is needed, redirect to your CAS server authentication form
entailment
protected function removeCasTicket($uri) { $parsed_url = parse_url($uri); // If there are no query parameters, then there is nothing to do. if (empty($parsed_url['query'])) { return $uri; } parse_str($parsed_url['query'], $query_params); // If there is no 'ticket' parameter, there is nothing to do. if (!isset($query_params[$this->query_ticket_parameter])) { return $uri; } // Remove the ticket parameter and rebuild the query string. unset($query_params[$this->query_ticket_parameter]); if (empty($query_params)) { unset($parsed_url['query']); } else { $parsed_url['query'] = http_build_query($query_params); } // Rebuild the URI from the parsed components. // Source: https://secure.php.net/manual/en/function.parse-url.php#106731 $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; $user = isset($parsed_url['user']) ? $parsed_url['user'] : ''; $pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : ''; $pass = ($user || $pass) ? "$pass@" : ''; $path = isset($parsed_url['path']) ? $parsed_url['path'] : ''; $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; return "$scheme$user$pass$host$port$path$query$fragment"; }
Strip the CAS 'ticket' parameter from a uri.
entailment
public function loadUserByUsername($username) { if ($username) { $password = '...'; $salt = ""; $roles = ["ROLE_USER"]; return new CasUser($username, $password, $salt, $roles); } throw new UsernameNotFoundException( sprintf('Username "%s" does not exist.', $username) ); }
Provides the authenticated user a ROLE_USER @param $username @return CasUser @throws UsernameNotFoundException
entailment
public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); $authenticator = $container->autowire('prayno.cas_authenticator', 'PRayno\CasAuthBundle\Security\CasAuthenticator'); $authenticator->setArguments(array($config)); $container->register('prayno.cas_user_provider', 'PRayno\CasAuthBundle\Security\User\CasUserProvider'); }
{@inheritdoc}
entailment
public function handle() { //CREATE AN ADMIN USER $firstName = $this->ask('What is your First Name:'); $lastName = $this->ask('What is your Last Name:'); $email = $this->ask('What is your Email:'); $password = $this->secret('What is your password:'); $role = Role::create(['name' => 'administrator', 'description' => 'Administrator Role has all access']); $adminUser = AdminUser::create([ 'first_name' => $firstName, 'last_name' => $lastName, 'email' => $email, 'password' => bcrypt($password), 'is_super_admin' => 1, 'role_id' => $role->id, ]); $request = $this->laravel->make('request'); $clientRepository = new ClientRepository; $clientRepository->createPasswordGrantClient($adminUser->id, $adminUser->full_name, $request->getUriForPath('/')); $this->info('AvoRed Ecommerce Administraotr Account Created Successfully!'); }
Execute the console command. @return void
entailment
public function update(ProductRequest $request, ProductModel $product) { //dd($request->all()); try { //$product = ProductModel::findorfail($id); $product->saveProduct($request->all()); } catch (\Exception $e) { throw new \Exception('Error in Saving Product: ' . $e->getMessage()); } return redirect()->route('admin.product.index'); }
Update the specified resource in storage. @param \AvoRed\Ecommerce\Http\Requests\ProductRequest $request @param int $id @return \Illuminate\Http\RedirectResponse|\Exception
entailment
public function deleteImage(Request $request) { $path = $request->get('path'); $path = 'uploads/catalog/images/e/0/v/1382542458778.jpeg'; $fileName = pathinfo($path, PATHINFO_BASENAME); $relativeDir = pathinfo($path, PATHINFO_DIRNAME); $sizes = config('avored-framework.image.sizes'); foreach ($sizes as $sizeName => $widthHeight) { $imagePath = $relativeDir . DIRECTORY_SEPARATOR . $sizeName . '-' . $fileName; if (File::exists($imagePath)) { File::delete(storage_path('app/public/' . $imagePath)); } } if (File::exists($path)) { File::delete(storage_path('app/public/' . $path)); } return JsonResponse::create(['success' => true]); }
upload image file and resized it. @param \Illuminate\Http\Request $request @return \Illuminate\Http\JsonResponse
entailment
public function downloadMainToken($token) { $downloadableUrl = $this->downRepository->findByToken($token); $path = storage_path("app/public" . DIRECTORY_SEPARATOR. $downloadableUrl->main_path); return response()->download($path); }
Products Downloadable Main Media Download. @param string $token @return \Illuminate\Http\JsonResponse
entailment
public function index() { $orderGrid = new OrderGrid($this->repository->query()->orderBy('id', 'desc')); return view('avored-ecommerce::order.index')->with('dataGrid', $orderGrid->dataGrid); }
Display a listing of the resource. @return \Illuminate\Http\Response
entailment
public function sendEmailInvoice(Model $order) { $user = $order->user; $view = view('avored-ecommerce::mail.order-pdf')->with('order', $order); $folderPath = public_path('uploads/order/invoice'); if (!File::exists($folderPath)) { File::makeDirectory($folderPath, '0775', true, true); } $path = $folderPath . DIRECTORY_SEPARATOR . $order->id . '.pdf'; PDF::loadHTML($view->render())->save($path); Mail::to($user->email)->send(new OrderInvoicedMail($order, $path)); return redirect()->back()->with('notificationText', 'Email Sent Successfully!!'); }
Send an Order Invioced PDF to User @param \AvoRed\Ecommerce\Models\Database\Order $order @return \Illuminate\Http\RedirectResponse
entailment
public function update(RoleRequst $request, Model $role) { try { $role->update($request->all()); $this->_saveRolePermissions($request, $role); } catch (\Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } return redirect()->route('admin.role.index')->with('notificationText', ' Role Updates Successfully!'); }
Update the specified resource in storage. @param \AvoRed\Ecommerce\Http\Requests\RoleRequst $request @param \AvoRed\Ecommerce\Models\Database\Role $role @return \Illuminate\Http\Response
entailment
public function compose(View $view) { $categoryOptions = Category::getCategoryOptions(); $storageOptions = []; //Storage::pluck('name', 'id'); $view->with('categoryOptions', $categoryOptions) ->with('storageOptions', $storageOptions); }
Bind data to the view. @param View $view @return void
entailment
public function index() { $attributeGrid = new Attribute($this->repository->query()); return view('avored-ecommerce::attribute.index')->with('dataGrid', $attributeGrid->dataGrid); }
Display a listing of the resource. @return \Illuminate\Http\Response
entailment
public function store(AttributeRequest $request) { $attribute = $this->repository->create($request->all()); $this->_saveDropdownOptions($attribute, $request); return redirect()->route('admin.attribute.index'); }
@param \AvoRed\Ecommerce\Http\Requests\AttributeRequest $request @return \Illuminate\Http\RedirectResponse
entailment
public function getAttribute(Request $request) { $attribute = Model::find($request->get('id')); return view('avored-ecommerce::attribute.attribute-card-values') ->with('attribute', $attribute); }
Get an attribute for Product Variation Modal. @param \Illuminate\Http\Request @return \Illuminate\Http\Response
entailment
public function getElementHtml(Request $request) { $attributes = $this->repository->findMany($request->get('attribute_id')); $tmpString = '__RANDOM__STRING__'; $view = view('avored-ecommerce::attribute.get-element') ->with('attributes', $attributes) ->with('tmpString', $tmpString); return new JsonResponse(['success' => true, 'content' => $view->render()]); }
Get the Element Html in Json Response. @param \Illuminate\Http\Request $request @return \Illuminate\Http\Response
entailment
private function _saveDropdownOptions($attribute, $request) { if (null !== $request->get('dropdown-options')) { if (null != $attribute->attributeDropdownOptions()->get() && $attribute->attributeDropdownOptions()->get()->count() >= 0 ) { $attribute->attributeDropdownOptions()->delete(); } foreach ($request->get('dropdown-options') as $key => $val) { if ($key == '__RANDOM_STRING__') { continue; } $attribute->attributeDropdownOptions()->create($val); } } }
Save Attribute Drop down Options. @param \AvoRed\Framework\Models\Database\Attribute $attribute @param \AvoRed\Ecommerce\Http\Requests\AttributeRequest $request @return void
entailment
public function index() { $frontMenus = MenuFacade::all(); $categories = Category::all(); $menus = $this->repository->parentsAll(); return view('avored-ecommerce::menu.index') ->with('categories', $categories) ->with('frontMenus', $frontMenus) ->with('menus', $menus); }
Display a listing of the resource. @return \Illuminate\Http\Response
entailment
public function store(Request $request) { $menuJson = $request->get('menu_json'); $menuArray = json_decode($menuJson); $this->repository->truncateAndCreateMenus($menuArray); return redirect()->route('admin.menu.index') ->with('notificationText', 'Menu Save Successfully!!'); }
Display a listing of the resource. @return \Illuminate\Http\Response
entailment
public function index() { $pageGrid = new PageGrid($this->repository->query()->orderBy('id', 'desc')); return view('avored-ecommerce::page.index')->with('dataGrid', $pageGrid->dataGrid); }
Display a listing of the Page. @return \Illuminate\Http\Response
entailment
public function edit(Model $page) { $widgetOptions = Widget::allOptions(); return view('avored-ecommerce::page.edit') ->with('model', $page) ->with('widgetOptions', $widgetOptions); }
Show the form for editing the specified page. @param \AvoRed\Ecommerce\Models\Database\Page $page @return \Illuminate\Http\Response
entailment
public function update(PageRequest $request, Model $page) { $page->update($request->all()); return redirect()->route('admin.page.index'); }
Update the specified page in database. @param \AvoRed\Ecommerce\Http\Requests\PageRequest $request @param \AvoRed\Ecommerce\Models\Database\Page $page @return \Illuminate\Http\RedirectResponse
entailment
public function compose(View $view) { $countries = Country::all(); $options = Collection::make(); foreach ($countries as $country) { $options->put($country->currency_code,['id' => $country->currency_code,'name' => $country->currency_code] ); } $statusOptions = Collection::make([['id' => 'ENABLED','name' => 'Enabled'],['id' => 'DISABLED','name' => 'Disabled']]); $view->with('codeOptions', $options) ->with('statusOptions',$statusOptions); }
Bind data to the view. @param \Illuminate\View\View $view @return void
entailment
public function compose(View $view) { $termConditionPageUrl = '#'; $user = Auth::user(); $pageId = Configuration::getConfiguration('general_term_condition_page'); if (null !== $pageId) { $page = Page::find($pageId); $termConditionPageUrl = route('page.show', $page->slug); } $cartProducts = Session::get('cart'); $view->with('cartProducts', $cartProducts) ->with('user', $user) ->with('termConditionPageUrl', $termConditionPageUrl); }
Bind data to the view. @param View $view @return void
entailment
public function boot() { $this->registerMiddleware(); $this->registerResources(); $this->registerViewComposerData(); $this->registerPassportResources(); $this->registerWidget(); $this->registerAdminMenu(); $this->registerBreadcrumb(); $this->registerPaymentOptions(); $this->registerShippingOption(); $this->registerPermissions(); $this->registerAdminConfiguration(); $this->registerAdminMakeCommand(); $this->registerModelContracts(); }
Bootstrap any application services. @return void
entailment
protected function registerResources() { $this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'avored-ecommerce'); $this->loadViewsFrom(__DIR__ . '/../resources/views', 'avored-ecommerce'); }
Registering AvoRed E commerce Resource e.g. Route, View, Database path & Translation. @return void
entailment
protected function registerMiddleware() { $router = $this->app['router']; $router->aliasMiddleware('currency', SiteCurrencyMiddleware::class); $router->aliasMiddleware('admin.api.auth', AdminApiAuth::class); $router->aliasMiddleware('admin.auth', AdminAuth::class); $router->aliasMiddleware('admin.guest', RedirectIfAdminAuth::class); $router->aliasMiddleware('permission', Permission::class); }
Registering AvoRed E commerce Middleware. @return void
entailment
public function registerViewComposerData() { View::composer('avored-ecommerce::layouts.left-nav', AdminNavComposer::class); View::composer('avored-ecommerce::site-currency._fields', SiteCurrencyFieldsComposer::class); View::composer(['avored-ecommerce::category._fields'], CategoryFieldsComposer::class); View::composer(['avored-ecommerce::admin-user._fields'], AdminUserFieldsComposer::class); View::composer(['avored-ecommerce::product.create', 'avored-ecommerce::product.edit', ], ProductFieldsComposer::class); }
Registering Class Based View Composer. @return void
entailment
protected function registerAdminMenu() { AdminMenuFacade::add('shop', function (AdminMenu $shopMenu) { $shopMenu->label('Shop') ->route('#') ->icon('fas fa-cart-plus'); }); $shopMenu = AdminMenuFacade::get('shop'); $productMenu = new AdminMenu(); $productMenu->key('product') ->label('Product') ->route('admin.product.index') ->icon('fab fa-dropbox'); $shopMenu->subMenu('product', $productMenu); $categoryMenu = new AdminMenu(); $categoryMenu->key('category') ->label('Category') ->route('admin.category.index') ->icon('far fa-building'); $shopMenu->subMenu('category', $categoryMenu); $attributeMenu = new AdminMenu(); $attributeMenu->key('attribute') ->label('Attribute') ->route('admin.attribute.index') ->icon('fas fa-file-alt'); $shopMenu->subMenu('attribute', $attributeMenu); $propertyMenu = new AdminMenu(); $propertyMenu->key('property') ->label('Property') ->route('admin.property.index') ->icon('fas fa-file-powerpoint'); $shopMenu->subMenu('property', $propertyMenu); $orderMenu = new AdminMenu(); $orderMenu->key('order') ->label('Order') ->route('admin.order.index') ->icon('fas fa-dollar-sign'); $shopMenu->subMenu('order', $orderMenu); AdminMenuFacade::add('cms', function (AdminMenu $cmsMenu) { $cmsMenu->label('CMS') ->route('#') ->icon('fas fa-building'); }); $cmsMenu = AdminMenuFacade::get('cms'); $pageMenu = new AdminMenu(); $pageMenu->key('page') ->label('Page') ->icon('fas fa-newspaper') ->route('admin.page.index'); $cmsMenu->subMenu('page', $pageMenu); $frontMenu = new AdminMenu(); $frontMenu->key('menu') ->label('Menu') ->route('admin.menu.index') ->icon('fas fa-leaf'); $cmsMenu->subMenu('menu', $frontMenu); AdminMenuFacade::add('system', function (AdminMenu $systemMenu) { $systemMenu->label('System') ->route('#') ->icon('fas fa-cogs'); }); $systemMenu = AdminMenuFacade::get('system'); $configurationMenu = new AdminMenu(); $configurationMenu->key('configuration') ->label('Configuration') ->route('admin.configuration') ->icon('fas fa-cog'); $systemMenu->subMenu('configuration', $configurationMenu); $currencySetup = new AdminMenu(); $currencySetup->key('site_currency_setup') ->label('Currency Setup') ->route('admin.site-currency.index') ->icon('fas fa-dollar-sign'); $systemMenu->subMenu('site_currency', $currencySetup); $adminUserMenu = new AdminMenu(); $adminUserMenu->key('admin-user') ->label('Admin User') ->route('admin.admin-user.index') ->icon('fas fa-user'); $systemMenu->subMenu('admin-user', $adminUserMenu); $roleMenu = new AdminMenu(); $roleMenu->key('roles') ->label('Role') ->route('admin.role.index') ->icon('fab fa-periscope'); $systemMenu->subMenu('roles', $roleMenu); $themeMenu = new AdminMenu(); $themeMenu->key('themes') ->label('Themes ') ->route('admin.theme.index') ->icon('fas fa-adjust'); $systemMenu->subMenu('themes', $themeMenu); //$moduleMenu = new AdminMenu(); $systemMenu->subMenu('module', function (AdminMenu $moduleMenu) { //dd($moduleMenu); $moduleMenu->key('module') ->label('Module') ->route('admin.module.index') ->icon('fas fa-adjust'); }); }
Register the Menus. @return void
entailment
protected function registerBreadcrumb() { BreadcrumbFacade::make('admin.dashboard', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Dashboard'); }); BreadcrumbFacade::make('admin.product.index', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Product') ->parent('admin.dashboard'); }); BreadcrumbFacade::make('admin.product.create', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Create') ->parent('admin.dashboard') ->parent('admin.product.index'); }); BreadcrumbFacade::make('admin.product.edit', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Edit') ->parent('admin.dashboard') ->parent('admin.product.index'); }); BreadcrumbFacade::make('admin.attribute.index', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Attribute') ->parent('admin.dashboard'); }); BreadcrumbFacade::make('admin.attribute.create', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Create') ->parent('admin.dashboard') ->parent('admin.attribute.index'); }); BreadcrumbFacade::make('admin.attribute.edit', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Edit') ->parent('admin.dashboard') ->parent('admin.attribute.index'); }); BreadcrumbFacade::make('admin.property.index', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Property') ->parent('admin.dashboard'); }); BreadcrumbFacade::make('admin.property.create', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Create') ->parent('admin.dashboard') ->parent('admin.property.index'); }); BreadcrumbFacade::make('admin.attribute.edit', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Edit') ->parent('admin.dashboard') ->parent('admin.attribute.index'); }); BreadcrumbFacade::make('admin.order.index', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Order') ->parent('admin.dashboard'); }); BreadcrumbFacade::make('admin.order.view', function (Breadcrumb $breadcrumb) { $breadcrumb->label('View') ->parent('admin.dashboard') ->parent('admin.order.index'); }); BreadcrumbFacade::make('admin.theme.index', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Theme') ->parent('admin.dashboard'); }); BreadcrumbFacade::make('admin.theme.create', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Upload') ->parent('admin.dashboard') ->parent('admin.theme.index'); }); BreadcrumbFacade::make('admin.role.index', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Role') ->parent('admin.dashboard'); }); BreadcrumbFacade::make('admin.role.create', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Create') ->parent('admin.dashboard') ->parent('admin.role.index'); }); BreadcrumbFacade::make('admin.role.edit', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Edit') ->parent('admin.dashboard') ->parent('admin.role.index'); }); BreadcrumbFacade::make('admin.admin-user.index', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Admin User') ->parent('admin.dashboard'); }); BreadcrumbFacade::make('admin.admin-user.create', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Create') ->parent('admin.dashboard') ->parent('admin.admin-user.index'); }); BreadcrumbFacade::make('admin.admin-user.edit', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Edit') ->parent('admin.dashboard') ->parent('admin.admin-user.index'); }); BreadcrumbFacade::make('admin.admin-user.show', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Show') ->parent('admin.dashboard') ->parent('admin.admin-user.index'); }); BreadcrumbFacade::make('admin.configuration', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Configuration') ->parent('admin.dashboard'); }); BreadcrumbFacade::make('admin.category.index', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Category') ->parent('admin.dashboard'); }); BreadcrumbFacade::make('admin.category.create', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Create') ->parent('admin.dashboard') ->parent('admin.category.index'); }); BreadcrumbFacade::make('admin.category.edit', function (Breadcrumb $breadcrumb) { $breadcrumb->label('Edit') ->parent('admin.dashboard') ->parent('admin.category.index'); }); }
Register the Menus. @return void
entailment
protected function registerPermissions() { $permissionGroup = PermissionFacade::add('category') ->label('Category Permissions'); $permissionGroup->addPermission('admin-category-list') ->label('Category List') ->routes('admin.category.index'); $permissionGroup->addPermission('admin-category-create') ->label('Create Category') ->routes('admin.category.create,admin.category.store'); $permissionGroup->addPermission('admin-category-update') ->label('Update Category') ->routes('admin.category.edit,admin.category.update'); $permissionGroup->addPermission('admin-category-destroy') ->label('Destroy Category') ->routes('admin.category.destroy'); $permissionGroup = PermissionFacade::add('product') ->label('Product Permissions'); $permissionGroup->addPermission('admin-product-list') ->label('Product List') ->routes('admin.product.index'); $permissionGroup->addPermission('admin-product-create') ->label('Create Product') ->routes('admin.product.create,admin.product.store'); $permissionGroup->addPermission('admin-product-update') ->label('Update Product') ->routes('admin.product.edit,admin.product.update'); $permissionGroup->addPermission('admin-product-destroy') ->label('Destroy Product') ->routes('admin.product.destroy'); $permissionGroup = PermissionFacade::add('attribute') ->label('Attribute Permissions'); $permissionGroup->addPermission('admin-attribute-list') ->label('Attribute List') ->routes('admin.attribute.index'); $permissionGroup->addPermission('admin-attribute-create') ->label('Attribute') ->routes('admin.attribute.create,admin.attribute.store'); $permissionGroup->addPermission('admin-attribute-update') ->label('Attribute') ->routes('admin.attribute.edit,admin.attribute.update'); $permissionGroup->addPermission('admin-attribute-destroy') ->label('Attribute') ->routes('admin.attribute.destroy'); $permissionGroup = PermissionFacade::add('property') ->label('Attribute Permissions'); $permissionGroup->addPermission('admin-property-list') ->label('Property List') ->routes('admin.property.index'); $permissionGroup->addPermission('admin-property-create') ->label('Property Create') ->routes('admin.property.create,admin.property.store'); $permissionGroup->addPermission('admin-attribute-update') ->label('Property Update') ->routes('admin.property.edit,admin.property.update'); $permissionGroup->addPermission('admin-property-destroy') ->label('Property Destroy') ->routes('admin.property.destroy'); $permissionGroup = PermissionFacade::add('admin-user') ->label('Admin User Permissions'); $permissionGroup->addPermission('admin-admin-user-list') ->label('Admin User List') ->routes('admin.admin-user.index'); $permissionGroup->addPermission('admin-admin-user-create') ->label('Admin User Create') ->routes('admin.admin-user.create,admin.admin-user.store'); $permissionGroup->addPermission('admin-admin-user-update') ->label('Admin User Update') ->routes('admin.admin-user.edit,admin.admin-user.update'); $permissionGroup->addPermission('admin-admin-user-destroy') ->label('Admin User Destroy') ->routes('admin.admin-user.destroy'); $permissionGroup = PermissionFacade::add('role') ->label('Role Permissions'); $permissionGroup->addPermission('admin-role-list') ->label('Role List') ->routes('admin.role.index'); $permissionGroup->addPermission('admin-role-create') ->label('Role Create') ->routes('admin.role.create,admin.role.store'); $permissionGroup->addPermission('admin-role-update') ->label('Role Update') ->routes('admin.role.edit,admin.role.update'); $permissionGroup->addPermission('admin-role-destroy') ->label('Role Destroy') ->routes('admin.role.destroy'); $permissionGroup = PermissionFacade::add('role') ->label('Theme Permissions'); $permissionGroup->addPermission('admin-theme-list') ->label('Theme List') ->routes('admin.theme.index'); $permissionGroup->addPermission('admin-theme-create') ->label('Theme Upload/Create') ->routes('admin.create.index', 'admin.theme.store'); $permissionGroup->addPermission('admin-theme-activated') ->label('Theme Activated') ->routes('admin.activated.index'); $permissionGroup->addPermission('admin-theme-deactivated') ->label('Theme Deactivated') ->routes('admin.deactivated.index'); $permissionGroup->addPermission('admin-theme-destroy') ->label('Theme Destroy') ->routes('admin.destroy.index'); $permissionGroup = PermissionFacade::add('configuration') ->label('Configuration Permissions'); $permissionGroup->addPermission('admin-configuration') ->label('Configuration') ->routes('admin.configuration'); $permissionGroup->addPermission('admin-configuration-store') ->label('Configuration Store') ->routes('admin.configuration.store'); $permissionGroup = PermissionFacade::add('order') ->label('Order Permissions'); $permissionGroup->addPermission('admin-order-list') ->label('Order List') ->routes('admin.order.index'); $permissionGroup->addPermission('admin-order-view') ->label('Order View') ->routes('admin.order.view'); $permissionGroup->addPermission('admin-order-send-invoice-email') ->label('Order Sent Invoice By Email') ->routes('admin.order.send-email-invoice'); $permissionGroup->addPermission('admin-order-change-status') ->label('Order Change Status') ->routes('admin.order.change-status,admin.order.update-status'); Blade::if('hasPermission', function ($routeName) { $condition = false; $user = Auth::guard('admin')->user(); if (!$user) { $condition = $user->hasPermission($routeName) ?: false; } $converted_res = ($condition) ? 'true' : 'false'; return "<?php if ($converted_res): ?>"; }); }
Register the permissions. @return void
entailment
protected function registerWidget() { $totalUserWidget = new TotalUserWidget(); WidgetFacade::make($totalUserWidget->identifier(), $totalUserWidget); $totalOrderWidget = new TotalOrderWidget(); WidgetFacade::make($totalOrderWidget->identifier(), $totalOrderWidget); }
Register the Widget. @return void
entailment
public function registerConfigData() { $authConfig = $this->app['config']->get('auth', []); $this->app['config']->set('auth', array_merge_recursive(require __DIR__ . '/../config/avored-auth.php', $authConfig)); $this->mergeConfigFrom(__DIR__ . '/../config/avored-ecommerce.php', 'avored-ecommerce'); }
Register the Config Data @return void
entailment
public function publishFiles() { $this->publishes([ __DIR__ . '/../config/avored-ecommerce.php' => config_path('avored-ecommerce.php'), ], 'config'); $this->publishes([ __DIR__ . '/../config/avored-auth.php' => config_path('avored-auth.php'), ], 'config'); $this->publishes([ __DIR__ . '/../resources/lang' => base_path('themes/avored/default/lang/vendor') ], 'avored-module-lang'); $this->publishes([ __DIR__ . '/../resources/views' => base_path('themes/avored/default/views/vendor') ], 'avored-module-views'); $this->publishes([ __DIR__ . '/../database/migrations' => database_path('avored-migrations'), ]); }
Register the Publish Files @return void
entailment
protected function registerModelContracts() { $this->app->bind(AdminUserInterface::class, AdminUserRepository::class); $this->app->bind(MenuInterface::class, MenuRepository::class); $this->app->bind(PageInterface::class, PageRepository::class); $this->app->bind(RoleInterface::class, RoleRepository::class); $this->app->bind(SiteCurrencyInterface::class, SiteCurrencyRepository::class); }
Register the Repository Instance. @return void
entailment
public function index() { $categoryGrid = new CategoryDataGrid($this->repository->query()); return view('avored-ecommerce::category.index')->with('dataGrid', $categoryGrid->dataGrid); }
Display a listing of the Category. @return \Illuminate\Http\Response
entailment
public function update(CategoryRequest $request, Model $category) { $category->update($request->all()); return redirect()->route('admin.category.index'); }
Update the specified resource in storage. @param \AvoRed\Ecommerce\Http\Requests\CategoryRequest $request @param \AvoRed\Framework\Models\Database\Category $category @return \Illuminate\Http\Response
entailment
public function rules() { if ($this->request->get('product_id', null) !== null) { $product = Product::findorfail($this->request->get('product_id')); } if (isset($product) && $product->type == 'VARIABLE_PRODUCT') { $rule['name'] = 'required|max:255'; $rule ['price'] = 'required|max:14|regex:/^-?\\d*(\\.\\d+)?$/'; $rule['sku'] = 'required|max:255'; $rule['qty'] = 'required'; } else { $rule['name'] = 'required|max:255'; $rule ['price'] = 'required|max:14|regex:/^-?\\d*(\\.\\d+)?$/'; $rule['sku'] = 'required|max:255'; //$rule['page_title'] = "max:255"; //$rule['page_description'] = "max:255"; $rule['description'] = 'required'; $rule['status'] = 'required'; $rule['is_taxable'] = 'required'; $rule['in_stock'] = 'required'; $rule['track_stock'] = 'required'; //@todo category validation if (strtolower($this->method()) == 'put' || strtolower($this->method()) == 'patch') { //$product = Product::find($this->route('product')); //$rule['slug'] = "required|max:255|alpha_dash|unique:products,slug," . $product->id; } } return $rule; }
Get the validation rules that apply to the request. @return array
entailment
public function up() { Schema::create('admin_password_resets', function (Blueprint $table) { $table->string('email')->index(); $table->string('token')->index(); $table->timestamp('created_at'); }); Schema::create('password_resets', function (Blueprint $table) { $table->string('email')->index(); $table->string('token')->index(); $table->timestamp('created_at'); }); Schema::create('roles', function (Blueprint $table) { $table->increments('id'); $table->string('name')->nullable()->default(null); $table->text('description')->nullable()->default(null); $table->timestamps(); }); Schema::create('admin_users', function (Blueprint $table) { $table->increments('id'); $table->tinyInteger('is_super_admin')->nullable(); $table->integer('role_id')->unsigned()->default(null); $table->string('first_name')->nullable(); $table->string('last_name')->nullable(); $table->string('email')->unique(); $table->string('password'); $table->string('language')->nullable()->default('en'); $table->string('image_path')->nullable()->default(null); $table->rememberToken(); $table->timestamps(); $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade'); }); Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('first_name'); $table->string('last_name'); $table->string('email')->unique(); $table->string('password'); $table->string('image_path')->nullable(); $table->string('company_name')->nullable(); $table->string('phone')->nullable(); $table->enum('status', ['GUEST', 'LIVE'])->default('LIVE'); $table->string('activation_token')->nullable()->default(null); $table->rememberToken(); $table->timestamps(); }); Schema::create('countries', function (Blueprint $table) { $table->increments('id'); $table->string('code'); $table->string('name'); $table->string('phone_code')->nullable()->default(null); $table->string('currency_code')->nullable()->default(null); $table->string('lang_code')->nullable()->default(null); $table->timestamps(); }); Schema::create('site_currencies', function (Blueprint $table) { $table->increments('id'); $table->string('code'); $table->string('name'); $table->float('conversion_rate'); $table->enum('status',['ENABLED','DISABLED'])->nullable()->default(null); $table->timestamps(); }); Schema::create('addresses', function (Blueprint $table) { $table->increments('id'); $table->integer('user_id')->unsigned(); $table->enum('type', ['SHIPPING', 'BILLING']); $table->string('first_name')->nullable()->default(null); $table->string('last_name')->nullable()->default(null); $table->string('address1')->nullable()->default(null); $table->string('address2')->nullable()->default(null); $table->string('postcode')->nullable()->default(null); $table->string('city')->nullable()->default(null); $table->string('state')->nullable()->default(null); $table->integer('country_id')->unsigned()->nullable()->default(null); $table->string('phone')->nullable()->default(null); $table->timestamps(); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $table->foreign('country_id')->references('id')->on('countries')->onDelete('cascade'); }); Schema::create('oauth_auth_codes', function (Blueprint $table) { $table->string('id', 100)->primary(); $table->integer('user_id'); $table->integer('client_id'); $table->text('scopes')->nullable(); $table->boolean('revoked'); $table->dateTime('expires_at')->nullable(); }); Schema::create('oauth_access_tokens', function (Blueprint $table) { $table->string('id', 100)->primary(); $table->integer('user_id')->index()->nullable(); $table->integer('client_id'); $table->string('name')->nullable(); $table->text('scopes')->nullable(); $table->boolean('revoked'); $table->timestamps(); $table->dateTime('expires_at')->nullable(); }); Schema::create('oauth_refresh_tokens', function (Blueprint $table) { $table->string('id', 100)->primary(); $table->string('access_token_id', 100)->index(); $table->boolean('revoked'); $table->dateTime('expires_at')->nullable(); }); Schema::create('oauth_clients', function (Blueprint $table) { $table->increments('id'); $table->integer('user_id')->index()->nullable(); $table->string('name'); $table->string('secret', 100); $table->text('redirect'); $table->boolean('personal_access_client'); $table->boolean('password_client'); $table->boolean('revoked'); $table->timestamps(); }); Schema::create('oauth_personal_access_clients', function (Blueprint $table) { $table->increments('id'); $table->integer('client_id')->index(); $table->timestamps(); }); Schema::create('pages', function (Blueprint $table) { $table->increments('id'); $table->string('name')->nullable()->default(null); $table->string('slug')->nullable()->default(null); $table->text('content')->nullable()->default(null); $table->string('meta_title')->nullable(); $table->string('meta_description')->nullable(); $table->timestamps(); }); Schema::create('wishlists', function (Blueprint $table) { $table->increments('id'); $table->integer('user_id')->unsigned(); $table->integer('product_id')->unsigned(); $table->timestamps(); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $table->foreign('product_id')->references('id')->on('products')->onDelete('cascade'); }); Schema::create('permissions', function (Blueprint $table) { $table->increments('id'); $table->string('name')->unique(); $table->timestamps(); }); Schema::create('permission_role', function (Blueprint $table) { $table->increments('id'); $table->integer('permission_id')->unsigned(); $table->integer('role_id')->unsigned(); $table->timestamps(); $table->foreign('permission_id')->references('id')->on('permissions')->onDelete('cascade'); $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade'); }); Schema::create('states', function (Blueprint $table) { $table->increments('id'); $table->integer('country_id')->unsigned(); $table->string('code'); $table->string('name'); $table->timestamps(); $table->foreign('country_id') ->references('id')->on('countries') ->onDelete('cascade'); }); Schema::table('orders', function (Blueprint $table) { $table->integer('user_id')->unsigned()->nullable(); $table->integer('shipping_address_id')->unsigned()->nullable(); $table->integer('billing_address_id')->unsigned()->nullable(); $table->foreign('user_id')->references('id')->on('users'); $table->foreign('shipping_address_id')->references('id')->on('addresses'); $table->foreign('billing_address_id')->references('id')->on('addresses'); }); $path = __DIR__ .'/../../assets/countries.json'; $json = json_decode(file_get_contents($path), true); foreach ($json as $code => $country) { Country::create(['code' => strtolower($code), 'name' => $country['name'], 'phone_code' => $country['phone'], 'currency_code' => $country['currency'], 'lang_code' => (isset($country['languages'][0]) && $country['languages']) ?? null, ]); } Schema::create('menus', function (Blueprint $table) { $table->increments('id'); $table->integer('parent_id')->nullable()->default(null); $table->string('name')->nullable()->default(null); $table->string('route')->nullable()->default(null); $table->string('params')->nullable()->default(null); $table->timestamps(); }); $countryModel = Country::whereCode('NZ')->first(); $siteCurrency = SiteCurrency::create([ 'name' => 'NZ Dollars', 'code' => 'NZD', 'conversion_rate' => 1, 'status' => 'ENABLED' ]); Configuration::create([ 'configuration_key' => 'general_site_currency', 'configuration_value' => $siteCurrency->id, ]); Configuration::create([ 'configuration_key' => 'tax_default_country', 'configuration_value' => $countryModel->id, ]); Configuration::create([ 'configuration_key' => 'tax_enabled', 'configuration_value' => 1, ]); Configuration::create([ 'configuration_key' => 'tax_percentage', 'configuration_value' => 15, ]); Configuration::create([ 'configuration_key' => 'general_site_title', 'configuration_value' => 'AvoRed an Laravel Ecommerce' ]); Configuration::create([ 'configuration_key' => 'general_site_description', 'configuration_value' => 'AvoRed is a free open-source e-commerce application development platform written in PHP based on Laravel. Its an ingenuous and modular e-commerce that is easily customizable according to your needs, with a modern responsive mobile friendly interface as default' ]); Configuration::create([ 'configuration_key' => 'general_site_description', 'configuration_value' => 'AvoRed Laravel Ecommerce ']); }
@todo arrange Database Table Creation and foreign keys Install the AvoRed Address Module Schema. @return void
entailment
public function index() { $themes = Theme::all(); $activeTheme = Configuration::getConfiguration('active_theme_identifier'); return view('avored-ecommerce::theme.index') ->with('themes', $themes) ->with('activeTheme', $activeTheme); }
Display a listing of the theme. @return \Illuminate\Http\Response
entailment
public function store(Request $request) { $filePath = $this->handleImageUpload($request->file('theme_zip_file')); $zip = new \ZipArchive(); if ($zip->open($filePath) === true) { $extractPath = base_path('themes'); $zip->extractTo($extractPath); $zip->close(); } else { throwException('Error in Zip Extract error.'); } return redirect()->route('admin.theme.index'); }
Store a newly created theme in database. @param \Illuminate\Http\Request $request @return \Illuminate\Http\Response
entailment
public function handle($request, Closure $next) { if(null === $request->get('currency_code') && null !== Session::get('currency_code')) { return $next($request); } $currencyCode = $request->get('currency_code'); if(null === $currencyCode) { $configCurrency = $this->repository->getValueByKey('general_site_currency'); $siteCurrencyModel = $this->curRep->find($configCurrency); $currencyCode = $siteCurrencyModel->code; } Session::put('currency_code', $currencyCode); return $next($request); }
Handle an incoming request. @param \Illuminate\Http\Request $request @param \Closure $next @param string|null $guard @return mixed
entailment
public function index() { $model = new Model(); $pageOptions = Page::Options(); $countryOptions = Country::options(); return view('avored-ecommerce::configuration.index') ->with('model', $model) ->with('pageOptions', $pageOptions) ->with('countryOptions', $countryOptions); }
Show the application dashboard. @return \Illuminate\Http\Response
entailment
public function index() { $propertyGrid = new Property(Model::query()->orderBy('id', 'desc')); return view('avored-ecommerce::property.index')->with('dataGrid', $propertyGrid->dataGrid); }
Display a listing of the Property. @return \Illuminate\Http\Response
entailment
public function store(PropertyRequest $request) { $property = Model::create($request->all()); $this->_saveDropdownOptions($property, $request); return redirect()->route('admin.property.index'); }
Store a newly created property in database. @param \AvoRed\Ecommerce\Http\Requests\PropertyRequest $request @return \Illuminate\Http\Response
entailment
public function update(PropertyRequest $request, Model $property) { $property->update($request->all()); $this->_saveDropdownOptions($property, $request); return redirect()->route('admin.property.index'); }
Update the specified property in database. @param \AvoRed\Ecommerce\Http\Requests\PropertyRequest $request @param \AvoRed\Framework\Models\Database\Property $property @return \Illuminate\Http\RedirectResponse
entailment
public function getElementHtml(Request $request) { $properties = Model::whereIn('id', $request->get('property_id'))->get(); $tmpString = str_random(); $view = view('avored-ecommerce::property.get-element') ->with('properties', $properties) ->with('tmpString', $tmpString); $json = new JsonResponse(['success' => true, 'content' => $view->render()]); return $json; }
Get the Element Html in Json Response. @param \Illuminate\Http\Request $request @return \Illuminate\Http\Response
entailment
private function _saveDropdownOptions($property, $request) { if (null !== $request->get('dropdown-options')) { $property->propertyDropdownOptions()->delete(); foreach ($request->get('dropdown-options') as $key => $val) { if ($key == '__RANDOM_STRING__') { continue; } $property->propertyDropdownOptions()->create($val); } } }
Save Property Dropdown Field options @param \AvoRed\Framework\Models\Database\Property $proerty @param \AvoRed\Ecommerce\Http\Request\PropertyRequest $request @return void
entailment
public function handle($request, Closure $next, $guard = 'admin') { if (Auth::guard($guard)->guest()) { return JsonResponse::create(['message' => 'you are not authorized to access this api', 'status' => false], 401); } $user = Auth::user(); if (isset($user->language) && ! empty($user->language)) { App::setLocale($user->language); } return $next($request); }
Handle an incoming request. @param \Illuminate\Http\Request $request @param \Closure $next @param string|null $guard @return mixed
entailment
public function compose(View $view) { $cart = (null === Session::get('cart')) ? 0 : count(Session::get('cart')); $menus = Menu::all(); $metaTitle = Configuration::getConfiguration('general_site_title'); $metaDescription = Configuration::getConfiguration('general_site_description'); $view->with('menus', $menus) ->with('cart', $cart) ->with('metaTitle', $metaTitle) ->with('metaDescription', $metaDescription); }
Bind data to the view. @param View $view @return void
entailment
public function rules() { $validationRule = []; $validationRule['name'] = 'required|max:255'; $validationRule['content'] = 'required'; if ($this->getMethod() == 'POST') { $validationRule['slug'] = 'required|max:255|alpha_dash|unique:pages'; } if ($this->getMethod() == 'PUT') { $validationRule['slug'] = 'required|max:255|alpha_dash'; } return $validationRule; }
Get the validation rules that apply to the request. @return array
entailment
public function index() { $totalRegisteredUser = User::all()->count(); $totalOrder = $this->repository->all()->count(); return view('avored-ecommerce::home') ->with('totalRegisteredUser', $totalRegisteredUser) ->with('totalOrder', $totalOrder); }
Show the application dashboard. @return \Illuminate\Http\Response
entailment
public function index() { $siteCurrencyGrid = new SiteCurrencyDataGrid($this->repository->query()); return view('avored-ecommerce::site-currency.index')->with('dataGrid', $siteCurrencyGrid->dataGrid); }
Display a listing of the resource. @return \Illuminate\Http\Response
entailment
public function destroy($id) { $siteCurreny = $this->repository->find($id); $siteCurreny->delete(); return redirect()->route('admin.site-currency.index'); }
Remove the specified resource from storage. @param int $id @return \Illuminate\Http\Response
entailment
public function setRows($rows) { if ($rows && count($rows) > 0) { foreach ($rows as $row) { $this->setRow($row); } } return $this; }
Set grid rows @param $rows @return $this
entailment
public function getColumn($column) { if ($this->columns->has($column)) { return $this->columns[$column]; } throw new ColumnException('Column not found!'); }
Get column by key @param $column @return mixed @throws ColumnException
entailment
public function setColumn($key, $title, $config = []) { $this->columns->put($key, new Column($key, $title, $config)); return $this; }
Set column @param string $key @param string $title @param array $config @return $this
entailment
public function setActionColumn($config = [], $key = 'actions', $title = 'Actions') { $column = new Column($key, $title, $config); $column->setAction(true); $this->columns->put($key, $column); return $this; }
Set grid action column TODO Refactor this to be able to use setColumn method @param array $config @param string $key @param string $title @return $this
entailment
public function getFilter($key, $default_value = '') { if ($this->filters->has($key)) { return $this->filters[$key]; } return $default_value; }
Get single filter by key @param $key @param string $default_value Default value if key is not found @return mixed|string
entailment
public function getFilters($to_array = true) { if ($to_array === true) { return $this->filters->toArray(); } return $this->filters; }
Get all filters @param bool $to_array If true will return filters as array. Default set to false. @return array|Collection
entailment
public function setFilters($filters = []) { if ($filters) { foreach ($filters as $key => $value) { $this->setFilter($key, $value); } } return $this; }
Set many filters @param array $filters Array of key => value pairs @return $this
entailment
public function hasFilters() { foreach ($this->columns as $col) { if ($col->hasFilters() === true) { return true; } } return false; }
Check if the datagrid has filters. Will loop through all columns and if any of the columns has filters this will mean that the datagrid will have filters in general. @return boolean
entailment
public function getSortParams($field) { // Clone the filters object. If you do not do this it will be passed // by reference and the values will be modified! $filters = clone $this->getFilters(false); if (!$filters->has('order_by')) { $filters->put('order_by', ''); } if (!$filters->has('order_dir')) { $filters->put('order_dir', 'ASC'); } if ($filters['order_by'] == $field) { if (!$filters->has('order_dir') || $filters['order_dir'] == 'ASC') { $filters->put('order_dir', 'DESC'); } else { $filters->put('order_dir', 'ASC'); } } else { $filters->put('order_by', $field); $filters->put('order_dir', 'ASC'); } $per_page = intval(\Illuminate\Support\Facades\Request::get('per_page', \Config::get('pagination.per_page'))); $per_page = $per_page > 0 ? $per_page : \Config::get('pagination.per_page'); return ['f' => $filters->toArray(), 'page' => 1, 'per_page' => $per_page]; }
Get array of data for sort links at the header of the grid @param $field @return array
entailment
public function initPagination($rows) { if ($rows instanceof Paginator) { $this->setPagination($rows->appends(Request::all())); } }
Init the grid pagination @param $rows
entailment
public static function getCurrentRouteLink($get_params = []) { $current_action = \Illuminate\Support\Facades\Route::current()->getAction(); $controller = '\\' . $current_action['controller']; $parameters = \Illuminate\Support\Facades\Route::current()->parameters(); return action($controller, $parameters) . ($get_params ? '?' . http_build_query($get_params) : ''); }
Current route link @param array $get_params @return string
entailment
public function setData($data) { $data = json_decode(json_encode($data), true); $this->data = array_dot($data); return $this; }
@param \stdClass $data @return $this
entailment
public function register() { // Register the HtmlServiceProvider $this->app->register(\Collective\Html\HtmlServiceProvider::class); // Add aliases to Form/Html Facade $loader = AliasLoader::getInstance(); // Add aliases to Form/Html Facade $loader->alias('Form', FormFacade::class); $loader->alias('Html', HtmlFacade::class); // Add alias for datagrid $loader->alias('Datagrid', Datagrid::class); }
Register the application services. @return void
entailment
public static function getRowInstance($row) { if (is_array($row)) { return new \Aginev\Datagrid\Rows\ArrayRow($row); } else if ($row instanceof Model) { return new \Aginev\Datagrid\Rows\ModelRow($row); } else if ($row instanceof Collection) { return new \Aginev\Datagrid\Rows\CollectionRow($row); } else if (is_object($row)) { return new \Aginev\Datagrid\Rows\ObjectRow($row); } throw new CellException('Unsupported data!'); }
Get row instance based on the data type @param $row @return Collection @throws CellException
entailment
public function getKey($refers_to = false) { if ($refers_to === true && $this->refers_to !== false) { return $this->refers_to; } return $this->key; }
Get column key @param bool $refers_to @return string
entailment
public function init(array $config) { if ($config) { foreach ($config as $key => $value) { $method = 'set' . ucfirst(camel_case($key)); if (method_exists($this, $method)) { $this->$method($value); } } } return $this; }
Setup column by passing config array. @param array $config @return $this
entailment
public function getFilters($first_blank = false) { $filters = $this->filters; if ($first_blank) { $filters = ['' => '---'] + $filters; } return $filters; }
Get column filters @param bool $first_blank @return array
entailment
public function setFilters($filters) { if ($filters instanceof Collection) { $filters = $filters->toArray(); } $this->filters = $filters; return $this; }
Set column filters @param $filters @return $this
entailment
public function setAttributes($attributes) { foreach ($attributes as $key => $string_values) { $values = explode(' ', $string_values); // Trim the values $values = array_map('trim', $values); // Remove empty elements $values = array_filter($values); // Remove duplicate values $values = array_unique($values); $this->attributes[$key] = $values; } return $this; }
@param $attributes @return $this
entailment
public function merge(Style $style) { if ($style->getDocument() == $this->document) { $this->document = $style->getDocument(); } if ($style->getSection() == $this->section) { $this->section = $style->getSection(); } if ($style->getParagraph() == $this->paragraph) { $this->paragraph = $style->getParagraph(); } if ($style->getCharacter() == $this->character) { $this->character = $style->getCharacter(); } return; }
Merges two styles Every element has a cloned style object. However, the style will usually change very litte element-to-element. Thus, it's a waste of space to have hundreds of identical objects in memory. I'll merge this style object with $style. If a state is identical between the two, I'll set this style's property to reference $style's property. @param Jstewmc\Rtf\Style $style the reference style @return self @since 0.1.0
entailment
public function run() { // if the control word has a next text element if (null !== ($text = $this->getNextText())) { // lower-case the text's first character $text->setText(lcfirst($text->getText())); } return; }
Runs the command @return void
entailment
public function read($string) { if ( ! is_string($string)) { throw new \InvalidArgumentException( __METHOD__."() expects parameter one, string, to be a string" ); } // fake the snippet as a "root" group $string = '{'.$string.'}'; // instantiate the string's chunker and stream $chunker = new \Jstewmc\Chunker\Text($string); $stream = new \Jstewmc\Stream\Stream($chunker); // lex the stream $tokens = (new Lexer())->lex($stream); // parse and render the tokens $group = (new Renderer())->render((new Parser())->parse($tokens)); // set the snippet's properties from the group $this->parent = null; $this->children = $group->getChildren(); $this->style = $group->getStyle(); $this->isRendered = true; return (bool) $group; }
Reads the snippet @param string $string the snippet's source code @return bool @throws InvalidArgumentException if $string is not a string @since 0.4.0
entailment
public function write($format = 'rtf') { if ( ! is_string($format)) { throw new \InvalidArgumentException( __METHOD__."() expects parameter one, format, to be a string" ); } // get the snippet (which is posing as a group) as a string $string = (new Writer())->write($this, $format); // if the format is "rtf", remove the group-open and group-close we added if ($format === 'rtf') { $string = substr($string, 1, -1); } return $string; }
Writes the snippet to a string @param string $format the desired format (possible values are "rtf", "text", and "html") (optional; if omitted, defaults to "rtf") @return string @throws InvalidArgumentException if $format is not a string @since 0.4.0
entailment
public function format($format = 'css') { $string = null; // if $format is a string if (is_string($format)) { // switch on format switch (strtolower($format)) { case 'css': // get the state's css properties as css declarations $declarations = []; if ($this->isBold) { $declarations[] = 'font-weight: bold'; } if ($this->isItalic) { $declarations[] = 'font-style: italic'; } if ($this->isSubscript) { $declarations[] = 'vertical-align: sub'; $declarations[] = 'font-size: smaller'; } if ($this->isSuperscript) { $declarations[] = 'vertical-align: super'; $declarations[] = 'font-size: smaller'; } if ($this->isStrikethrough) { $declarations[] = 'text-decoration: line-through'; } if ($this->isUnderline) { $declarations[] = 'text-decoration: underline'; } if ( ! $this->isVisible) { $declarations[] = 'display: none'; } if ( ! empty($declarations)) { $string = implode('; ', $declarations).';'; } break; default: throw new \InvalidArgumentException( __METHOD__."() expects paramter one, format, to be a supported format" ); } } else { throw new \InvalidArgumentException( __METHOD__."() expects parameter one, format, to be a string" ); } return $string; }
Returns the character state as a string in $format @param string $format the desired format (possible values are 'css') @return string @throws InvalidArgumentException if $format is not a string @throws InvalidArgumentException if $format is not valid @since 0.1.0
entailment
public function run() { $this->style->getCharacter()->setIsVisible( $this->parameter === null || (bool) $this->parameter ); return; }
Runs the command @return void
entailment
public function parse(Array $tokens) { // if groups are mis-matched, short-circuit if ($this->countGroupOpen($tokens) !== $this->countGroupClose($tokens)) { throw new \InvalidArgumentException( __METHOD__."() expects parameter one, tokens, to be valid RTF " . "string; however, the number of groups opened does not equal " . "the number of groups closed" ); } $root = null; // loop through the tokens $stack = new \SplStack(); foreach ($tokens as $token) { // if the token is a group-open token if ($token instanceof Token\Group\Open) { $this->parseGroupOpen($token, $stack, $root); if ($root === null) { $root = $stack->bottom(); } } else { // if at least a root group exists if ($stack->count()) { if ($token instanceof Token\Group\Close) { $this->parseGroupClose($token, $stack); } elseif ($token instanceof Token\Control\Word) { $this->parseControlWord($token, $stack->top()); } elseif ($token instanceof Token\Control\Symbol) { $this->parseControlSymbol($token, $stack->top()); } elseif ($token instanceof Token\Text) { $this->parseText($token, $stack->top()); } } else { // otherwise, ignore the tokens // hmmm, this is good because if text preceeds the root group // (observed in wild) it's ignored as it should be; however, // it's also bad, because if an extra bracket closes the // root-group early (also observed in the wild), it's not an // error // } } } return $root; }
Parses tokens into a parse tree @param Jstewmc\Rtf\Token[] $tokens an array of tokens to parse @return Jstewmc\Rtf\Element\Group|null the parse tree's root group (or null if $tokens is an empty array) @throws InvalidArgumentException if groups are mismatched in $tokens @since 0.1.0 @since 0.4.2 add test for group-open and group-close mismatch
entailment
protected function countGroupClose(Array $tokens) { return array_reduce($tokens, function ($carry, $item) { return $carry += $item instanceof Token\Group\Close; }, 0); }
Returns the number of group-close tokens in $tokens @param Jstewmc\Rtf\Token\Token $tokens the tokens to test @return int @since 0.4.2
entailment
protected function countGroupOpen(Array $tokens) { return array_reduce($tokens, function ($carry, $item) { return $carry += $item instanceof Token\Group\Open; }, 0); }
Counts the number of group-open tokens @param Jstewmc\Rtf\Token\Token $tokens the tokens to test @return int @since 0.4.2
entailment
protected function parseControlSymbol(Token\Control\Symbol $token, Element\Group $group) { // if a class exists for the symbol, instantiate it; otherwise, instantiate // a generic control symbol element // keep in mind, class_exists() requires a fully-qualified namespace // if (array_key_exists($token->getSymbol(), self::$symbols)) { // get the symbol's name $name = self::$symbols[$token->getSymbol()]; $name = ucfirst($name); $classname = "Jstewmc\\Rtf\\Element\\Control\\Symbol\\$name"; if (class_exists($classname)) { $symbol = new $classname(); } else { $symbol = new Element\Control\Symbol\Symbol(); $symbol->setSymbol($token->getSymbol()); } } else { $symbol = new Element\Control\Symbol\Symbol(); $symbol->setSymbol($token->getSymbol()); } // set the symbol's parameter $symbol->setParameter($token->getParameter()); $symbol->setIsSpaceDelimited($token->getIsSpaceDelimited()); // append the element $symbol->setParent($group); $group->appendChild($symbol); return; }
Parses a control symbol token @param Jstewnc\Rtf\Token\Control\Symbol $token the control symbol token @param Jstewmc\Rtf\Element\Group $group the current group @return void @since 0.1.0
entailment