Skip to content

Commit f01288a

Browse files
committed
Code style improvements
1 parent 2e4c0fb commit f01288a

File tree

15 files changed

+41
-40
lines changed

15 files changed

+41
-40
lines changed

Block/Adminhtml/AiButton.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ public function __construct(
2424
Config $config,
2525
Context $context,
2626
array $data = []
27-
)
28-
{
27+
) {
2928
$this->config = $config;
3029
parent::__construct($context, $data);
3130
}
@@ -49,5 +48,4 @@ protected function _prepareLayout()
4948
}
5049
return $this;
5150
}
52-
5351
}

Block/Adminhtml/Comment/ReplyButton.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public function getButtonData()
3636
*/
3737
public function getBackUrl()
3838
{
39-
return $this->getUrl('*/*/addreply/',['id' => $this->getObjectId()]);
39+
return $this->getUrl('*/*/addreply/', ['id' => $this->getObjectId()]);
4040
}
41-
}
41+
}

Block/Adminhtml/Grid/Column/Render/Image.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class Image extends AbstractRenderer
1818
public function __construct(
1919
Url $url,
2020
Context $context,
21-
array $data = [])
22-
{
21+
array $data = []
22+
) {
2323
$this->_url = $url;
2424
parent::__construct($context, $data);
2525
}
@@ -36,4 +36,4 @@ public function render(DataObject $row)
3636
}
3737
return '';
3838
}
39-
}
39+
}

Block/Adminhtml/Widget/Featured/Grid/Chooser.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ protected function _toHtml() : string
183183
$buttons['open']
184184
)->setOnclick(
185185
$this->onClickJs($chooserId)
186-
/* )->setDisabled(
187-
$element->getReadonly()*/
186+
/* )->setDisabled(
187+
$element->getReadonly()*/
188188
);
189189
$chooser->setData('after_element_html', $hiddenHtml . $chooseButton->toHtml());
190190

Block/Post/View/Richsnippets.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function getPublisher()
163163
protected function _toHtml()
164164
{
165165
$options = $this->getOptions();
166-
if (!$options){
166+
if (!$options) {
167167
return '';
168168
}
169169
return '<script type="application/ld+json">'

Controller/Adminhtml/Comment/AddReply.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public function __construct(
5454
Session $session,
5555
Context $context,
5656
Manager $manager,
57-
DataPersistorInterface $dataPersistor)
58-
{
57+
DataPersistorInterface $dataPersistor
58+
) {
5959
$this->comment = $comment;
6060
$this->session = $session;
6161
$this->manager = $manager;
@@ -106,5 +106,4 @@ public function execute()
106106

107107
return $resultRedirect;
108108
}
109-
110109
}

Controller/Adminhtml/CreateWithAi/Index.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ class Index extends \Magento\Backend\App\Action
4141
* @param Config $config
4242
* @param Context $context
4343
*/
44-
public function __construct(
45-
PageFactory $resultPageFactory,
46-
Config $config,
47-
Context $context
48-
)
49-
{
44+
public function __construct(
45+
PageFactory $resultPageFactory,
46+
Config $config,
47+
Context $context
48+
) {
5049
$this->resultPageFactory = $resultPageFactory;
5150
$this->config = $config;
5251
parent::__construct($context);
@@ -77,4 +76,4 @@ public function execute()
7776
);
7877
return $pageFactory;
7978
}
80-
}
79+
}

Controller/Adminhtml/Post/Save.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected function _beforeSave($model, $request)
3535
}
3636

3737
/* Prepare empty categories and coauthors */
38-
foreach(['categories', 'coauthors'] as $key) {
38+
foreach (['categories', 'coauthors'] as $key) {
3939
if (!$request->getPost($key)) {
4040
$model->setData($key, []);
4141
}

Model/Import/AbstractImport.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ protected function getDbAdapter()
268268
$this->dbAdapter = new \Laminas\Db\Adapter\Adapter($connectionConf);
269269

270270
try {
271-
$this->dbAdapter->query('SELECT 1')->execute();
271+
$this->dbAdapter->query('SELECT 1')->execute();
272272
} catch (\Exception $e) {
273273
throw new \Exception("Failed connect to the database.");
274274
}

Model/Import/Mageplaza.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function execute()
4141
t.meta_title as meta_title,
4242
t.meta_keywords as meta_keywords,
4343
t.meta_description as meta_description,
44-
*/
44+
*/
4545
't.description as content,
4646
t.parent_id as parent_id,
4747
t.enabled as is_active,
@@ -120,8 +120,8 @@ public function execute()
120120
t.description as content, ' .
121121
/*
122122
t.meta_title as meta_title,
123-
t.meta_description as meta_description,
124-
t.meta_keywords as meta_keywords,
123+
t.meta_description as meta_description,
124+
t.meta_keywords as meta_keywords,
125125
*/
126126
't.enabled as is_active
127127
FROM ' . $_pref . 'mageplaza_blog_tag t';

Model/Post.php

+11-6
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,9 @@ public function getParentCategories()
670670
if ($category->getId() && $category->isVisibleOnStore($this->getStoreId())) {
671671
$this->_parentCategories[$categoryId] = $category;
672672
}
673-
} catch (NoSuchEntityException $e) { }
673+
} catch (NoSuchEntityException $e) {
674+
675+
}
674676
}
675677
uasort($this->_parentCategories, [$this, 'sortByPositionDesc']);
676678
}
@@ -685,7 +687,8 @@ public function getParentCategories()
685687
* @param $b
686688
* @return int
687689
*/
688-
public function sortByPositionDesc($a, $b) {
690+
public function sortByPositionDesc($a, $b)
691+
{
689692
return strcmp($b->getPosition(), $a->getPosition());
690693
}
691694

@@ -857,7 +860,9 @@ public function getAuthor()
857860
if ($_author->getId() && $_author->isVisibleOnStore($this->getStoreId())) {
858861
$author = $_author;
859862
}
860-
} catch (NoSuchEntityException $e) { }
863+
} catch (NoSuchEntityException $e) {
864+
865+
}
861866
}
862867
$this->setData('author', $author);
863868
}
@@ -1147,13 +1152,13 @@ public function getReadingTime()
11471152
if (!$this->getData('reading_time')) {
11481153
$wpm = 250;
11491154
$contentHtml = $this->getFilteredContent();
1150-
$numberOfImages = substr_count( strtolower( $contentHtml ), '<img ' );
1155+
$numberOfImages = substr_count(strtolower($contentHtml), '<img ');
11511156
$additionalWordsForImages = (int)($numberOfImages * 12) / $wpm;
1152-
$wordCount = count(preg_split( '/\s+/', strip_tags($contentHtml)));
1157+
$wordCount = count(preg_split('/\s+/', strip_tags($contentHtml)));
11531158

11541159
$readingTime = 1;
11551160

1156-
if (!$wordCount && !$additionalWordsForImages){
1161+
if (!$wordCount && !$additionalWordsForImages) {
11571162
return $readingTime;
11581163
}
11591164
$readingTime = ceil(($wordCount + $additionalWordsForImages) / $wpm);

Model/ResourceModel/Post.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,11 @@ public function updateLinks(
231231
\Magento\Framework\Model\AbstractModel $object,
232232
array $newRelatedIds,
233233
array $oldRelatedIds,
234-
$tableName,
235-
$field,
236-
$rowData = []
237-
)
238-
{
239-
return $this->_updateLinks($object, $newRelatedIds, $oldRelatedIds, $tableName, $field, $rowData);
234+
$tableName,
235+
$field,
236+
$rowData = []
237+
) {
238+
return $this->_updateLinks($object, $newRelatedIds, $oldRelatedIds, $tableName, $field, $rowData);
240239
}
241240

242241
/**

Model/Sitemap/ItemProvider/Post.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function getItems($storeId)
7777
$images[] = new \Magento\Framework\DataObject(['url' => $item->getFeaturedImage()]);
7878
}
7979
if ($item->getGalleryImages()) {
80-
$images = array_merge( $images, $item->getGalleryImages());
80+
$images = array_merge($images, $item->getGalleryImages());
8181
}
8282

8383
if ($images) {

Setup/UpgradeSchema.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
801801
}
802802
}
803803

804-
if (version_compare($version,'2.11.1') < 0) {
804+
if (version_compare($version, '2.11.1') < 0) {
805805
$connection->addColumn(
806806
$setup->getTable('magefan_blog_post'),
807807
'structure_data_type',

ViewModel/Style.php

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Framework\View\Asset\Source;
1212
use Magento\Framework\View\Asset\Repository as AssetRepository;
1313
use Magefan\Blog\Model\Config;
14+
1415
/**
1516
* Class AbstractCss
1617
*/

0 commit comments

Comments
 (0)