Skip to content

Commit 2e0f55a

Browse files
committed
update docs content
1 parent 795496a commit 2e0f55a

File tree

13 files changed

+92
-95
lines changed

13 files changed

+92
-95
lines changed

src/app/core/asynchronous/asynchronous.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,18 @@ <h3>Async/Await Pattern</h3>
111111
$data = $task->getAwaiter()->getResult();
112112
</code></pre>
113113
<p>
114-
Here is the same example in an object-oriented way, where the async method must be prefixed with the <code>async_</code> keyword, and the class that has the async method must use the <code>DevNet\System\Tweak</code> trait to enable this feature.
114+
Here is the same example in an object-oriented way, where the async method must be prefixed with the <code>async_</code> keyword, and the class that has the async method must use the trait <code>DevNet\System\MethodTrait</code> to enable this feature.
115115
</p>
116116
<pre><code class="language-php">&lt;?php
117117

118118
use DevNet\System\IO\FileStream;
119-
use DevNet\System\Tweak;
119+
use DevNet\System\MethodTrait;
120120

121121
use function DevNet\System\await;
122122

123123
class Reader &lcub;
124124

125-
use Tweak;
125+
use MethodTrait;
126126

127127
public async_readJsonAsync(function($path): string
128128
&lcub;

src/app/core/delegates/delegates.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ <h5>Event Handler</h5>
201201
</a>
202202
</li>
203203
<li class="nav-page-item">
204-
<a class="nav-page-link" routerLink="/docs/core/diagnostics">
204+
<a class="nav-page-link" routerLink="/docs/core/logging">
205205
Next <i class="chevron right"></i>
206206
</a>
207207
</li>

src/app/core/extension/extension.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ <h1>Extension Methods</h1>
1212
</p>
1313
<h3>Extended class</h3>
1414
<p>
15-
The extended class is the class that the extension method operates on, and must include the trait <code>DevNet\System\Tweak</code> to enable this feature like in the following code example:
15+
The extended class is the class that the extension method operates on, and must include the trait <code>DevNet\System\MethodTrait</code> to enable this feature like in the following code example:
1616
</p>
1717
<pre><code class="language-php">&lt;?php
1818

1919
namespace Application\Models;
2020

21-
use DevNet\System\Tweak;
21+
use DevNet\System\MethodTrait;
2222

2323
class Employee
2424
&lcub;
25-
use Tweak;
25+
use MethodTrait;
2626

2727
public string $Name;
2828
public float $Salary ;
@@ -73,7 +73,7 @@ <h3>Calling the extension method</h3>
7373
</p>
7474
<br>
7575
<blockquote class="alert alert-info">
76-
<b>Note:</b> One of the best examples of extension methods is the <b>LINQ</b> methods that allow to perform queries on collections of type <code>IEnumerable</code>, More details about this feature can be found in the <a routerLink="/docs/core/linq">LINQ</a> section.
76+
<b>Note:</b> One of the best examples of extension methods is the <b>LINQ</b> methods that allow to perform queries on collections of type <code>IEnumerable</code>, More details about this feature in the upcoming section.
7777
</blockquote>
7878
</article>
7979
<nav class="no-print" aria-label="Page navigation">

src/app/core/generics/generics.component.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ <h3>Generic type parameter</h3>
1919
To define a type parameter in a generic class, define a type that inherits from <code>DevNet\System\Parameter</code> and attribute that type parameter to that generic class using the <code>DevNet\System\Generic</code> attribute, then set the generic type arguments through the constructor injection.
2020
</p>
2121
<p>
22-
To work with this feature, you need to include the <code>DevNet\System\Tweak</code> trait in your generic class and the method that deals with the generic parameter should be private to trigger a magic method in the background for the type-checking and the injection of the value argument into the parameter type instance that works as a wrapper. Then you can get the argument value by invoking that wrapper as a callable.
22+
To work with this feature, you need to include the trait <code>DevNet\System\MethodTrait</code> in your generic class and the method that deals with the generic parameter should be private to trigger a magic method in the background for the type-checking and the injection of the value argument into the parameter type instance that works as a wrapper. Then you can get the argument value by invoking that wrapper as a callable.
2323
</p>
2424
<p>
2525
Here is an example explaining how to create a generic class using this feature:
@@ -31,15 +31,15 @@ <h3>Generic type parameter</h3>
3131
use DevNet\System\Collections\Enumerator;
3232
use DevNet\System\Collections\IEnumerable;
3333
use DevNet\System\Generic;
34-
use DevNet\System\Tweak;
34+
use DevNet\System\MethodTrait;
3535

3636
// Defining the type parameter T as a type of the items in the collection.
3737
class T extends \Devnet\System\Parameter &lcub;}
3838

3939
#[Generic(T::class)]
4040
class Collection implements IEnumerable
4141
&lcub;
42-
use Tweak;
42+
use MethodTrait;
4343

4444
private array $items = [];
4545

@@ -78,15 +78,15 @@ <h3>Generic type argument</h3>
7878
$employee->Name = 'Alice';
7979

8080
// Create an instance of type Collection&lt;Employee>
81-
$collection = new Collection(Employee::class);
81+
$employees = new Collection(Employee::class);
8282

8383
// Now this method accepts only arguments of type Employee, other wise will throw a TypeException.
84-
$collection->add($employee);
84+
$employees->add($employee);
8585
</code></pre>
8686
<br>
8787
<h3>Checking generic type</h3>
8888
<p>
89-
Every class uses the <code>Tweak</code> has a <code>getType()</code> method that returns a reflection class type. You can use this reflection type to examine the generic type and its type parameters, and you can also use the <code>TypeOf()</code> function to create an instance of a type that represents a generic type that you want use for compare.
89+
Every class uses the <code>MethodTrait</code> has a <code>getType()</code> method that returns a reflection class type. You can use this reflection type to examine the generic type and its type parameters, and you can also use the <code>TypeOf()</code> function to create an instance of a type that represents a generic type that you want use for compare.
9090
</p>
9191
<pre><code class="language-php">&lt;?php
9292

@@ -129,15 +129,15 @@ <h3>Multiple type parameters</h3>
129129
namespace Application\Collections;
130130

131131
use DevNet\System\Generic;
132-
use DevNet\System\Tweak;
132+
use DevNet\System\MethodTrait;
133133

134134
class K extends \Devnet\System\Parameter &lcub;}
135135
class V extends \Devnet\System\Parameter &lcub;}
136136

137137
#[Generic(K::class, V::class)]
138138
class Collection
139139
&lcub;
140-
use Tweak;
140+
use MethodTrait;
141141

142142
private array $items = [];
143143

src/app/core/linq/linq.component.html

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ <h1>Language Integrated Query</h1>
1111
LINQ, or Language Integrated Query, is an integration of query capabilities as expressions of extension methods against data, such as in-memory data, document databases, or SQL databases.
1212
</p>
1313
<p>
14-
Any collection class of type <code>IEnumerable</code> or <code>IQueryable</code> that uses the <code>DevNet\System\Extension\Tweak</code> to support the extension method can take advantage of using LINQ extension methods.
14+
Any collection class of type <code>IEnumerable</code> or <code>IQueryable</code> that uses the <code>DevNet\System\MethodTrait</code> to support the extension method can take advantage of using LINQ extension methods.
1515
</p>
1616
<p>
1717
The difference between <code>IEnumerable</code> and <code>IQueryable</code> types is that the implementation of the <code>IEnumerable</code> type, like the <code>ArrayList</code>, uses LINQ against in-memory data, while the implementation of the <code>IQueryable</code> type, like the <code>EntitySet</code> repository of DevNet Entity ORM, uses LINQ against SQL database, which means that this one uses <code>IQueryProvider</code> to compile the predicate expressions of the LINQ methods to SQL query syntax.
@@ -29,12 +29,12 @@ <h3>Using LINQ extension methods</h3>
2929
$list = new ArrayList(Employee::class);
3030

3131
// assuming we have Employee class with constructor that initializes Id and Name properties.
32-
$list[] = new Employee(11, 'bob');
33-
$list[] = new Employee(12, 'carol');
34-
$list[] = new Employee(13, 'ted');
35-
$list[] = new Employee(14, 'alice');
36-
$list[] = new Employee(15, 'carol');
37-
$list[] = new Employee(16, 'ted');
32+
$list[] = new Employee(1, 'bob');
33+
$list[] = new Employee(2, 'carol');
34+
$list[] = new Employee(3, 'ted');
35+
$list[] = new Employee(4, 'alice');
36+
$list[] = new Employee(5, 'carol');
37+
$list[] = new Employee(6, 'ted');
3838
</code></pre>
3939
<br>
4040
<h5>Picking</h5>
@@ -44,14 +44,14 @@ <h5>Picking</h5>
4444
print("Last employee is &lcub;$last->Name} with Id &lcub;$last->Id}\n");
4545
</code></pre>
4646
<h6>Output:</h6>
47-
<pre><code class="language-shell">First employee is bob with Id 11
48-
Last employee is ted with Id 16
47+
<pre><code class="language-shell">First employee is bob with Id 1
48+
Last employee is ted with Id 6
4949
</code></pre>
5050
<br>
5151
<h5>Filtring</h5>
52-
<pre><code class="language-php">print("Employees with Id greater than 12\n");
52+
<pre><code class="language-php">print("Employees with Id greater than 2\n");
5353

54-
$employees = $list->where(fn($employee) => $employee->Id > 12);
54+
$employees = $list->where(fn($employee) => $employee->Id > 2);
5555
foreach ($employees as $employee) &lcub;
5656
print("&lcub;$employee->Id} => &lcub;$employee->Name}\n");
5757
}
@@ -65,15 +65,15 @@ <h5>Filtring</h5>
6565
}
6666
</code></pre>
6767
<h6>Output:</h6>
68-
<pre><code class="language-shell">Employees with Id greater than 12
69-
13 => ted
70-
14 => alice
71-
15 => carol
72-
16 => ted
68+
<pre><code class="language-shell">Employees with Id greater than 2
69+
3 => ted
70+
4 => alice
71+
5 => carol
72+
6 => ted
7373

7474
Employees with Name ted
75-
13 => ted
76-
16 => ted
75+
3 => ted
76+
6 => ted
7777
</code></pre>
7878
<br>
7979
<h5>Sorting</h5>
@@ -94,20 +94,20 @@ <h5>Sorting</h5>
9494
</code></pre>
9595
<h6>Output:</h6>
9696
<pre><code class="language-shell">Ascending order by Name
97-
14 => alice
98-
11 => bob
99-
12 => carol
100-
15 => carol
101-
13 => ted
102-
16 => ted
97+
4 => alice
98+
1 => bob
99+
2 => carol
100+
5 => carol
101+
3 => ted
102+
6 => ted
103103

104104
Descending order by Id
105-
16 => ted
106-
15 => carol
107-
14 => alice
108-
13 => ted
109-
12 => carol
110-
11 => bob
105+
6 => ted
106+
5 => carol
107+
4 => alice
108+
3 => ted
109+
2 => carol
110+
1 => bob
111111
</code></pre>
112112
<br>
113113
<h5>Paging</h5>
@@ -119,9 +119,9 @@ <h5>Paging</h5>
119119
}
120120
</code></pre>
121121
<h6>Output:</h6>
122-
<pre><code class="language-shell">13 => ted
123-
14 => alice
124-
15 => carol
122+
<pre><code class="language-shell">3 => ted
123+
4 => alice
124+
5 => carol
125125
</code></pre>
126126
<br>
127127
<h5>Aggregating</h5>
@@ -135,8 +135,8 @@ <h5>Aggregating</h5>
135135
</code></pre>
136136
<h6>Output:</h6>
137137
<pre><code class="language-shell">Tolat employess => 6
138-
Max employee Id => 16
139-
Min employee Id => 11
138+
Max employee Id => 6
139+
Min employee Id => 1
140140
</code></pre>
141141
<br>
142142
<h5>Grouping</h5>

src/app/core/overview/overview.component.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ <h1>Overview</h1>
1111
DevNet Core is the heart of the DevNet framework, and all of its components rely on it. It is a base class library that provides several fundamental features that make it easier to develop applications in PHP. These features include:
1212
</p>
1313
<ul>
14-
<li>Computed properties</li>
15-
<li>Extension methods</li>
16-
<li>Generic types</li>
17-
<li>Asynchronous operations</li>
18-
<li>Event delegates</li>
19-
<li>LINQ</li>
20-
<li>and more...</li>
14+
<li>Computed Properties</li>
15+
<li>Extension Methods</li>
16+
<li>LINQ Methods</li>
17+
<li>Generic Types</li>
18+
<li>Asynchronous Operations</li>
19+
<li>Delegates & Events</li>
20+
<li>And more...</li>
2121
</ul>
2222
<br>
2323
<h3>Installation</h3>

src/app/core/properties/properties.component.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ <h3>Getter</h3>
1515
A getter is a function bound to a computed property and returns a value when that property is looked up.
1616
</p>
1717
<p>
18-
To use a getter for a computed property in DevNet, you need first to include the trait <code>DevNet\System\Tweak</code> in your class to enable this feature, then define the computed property as a method prefixed with <code>get</code> that returns a value.
18+
To use a getter for a computed property in DevNet, you need first to include the trait <code>DevNet\System\PropertyTrait</code> in your class to enable this feature, then define the computed property as a method prefixed with <code>get</code> that returns a value.
1919
</p>
2020
<pre><code class="language-php">&lt;?php
2121

2222
namespace Application\Models;
2323

24-
use DevNet\System\Tweak;
24+
use DevNet\System\PropertyTrait;
2525

2626
class Person
2727
&lcub;
28-
use Tweak;
28+
use PropertyTrait;
2929

3030
public string $FirstName;
3131
public string $LastName;
@@ -64,11 +64,11 @@ <h3>Setter</h3>
6464

6565
namespace Application\Models;
6666

67-
use DevNet\System\Tweak;
67+
use DevNet\System\PropertyTrait;
6868

6969
class Person
7070
&lcub;
71-
use Tweak;
71+
use PropertyTrait;
7272

7373
public string $FirstName;
7474
public string $LastName;

src/app/docs/docs.component.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="d-flex flex-column justify-content-center text-center" style="height: 300px; background-color: rebeccapurple;">
1+
<div class="d-flex flex-column justify-content-center text-center" style="height: 280px; background-color: rebeccapurple;">
22
<h1 class="text-white display-4 mx-auto">DevNet Documentation</h1>
33
<p class="lead text-white w-75 mx-auto">Learn how to use DevNet Framework for rapid application development on any
44
platform, using PHP with a new experience to the next level.</p>
@@ -45,18 +45,18 @@ <h5 class="card-title">Web Appliaction</h5>
4545
<div class="col-sm-6 col-md-4 mb-3">
4646
<div class="card shadow-sm h-100 p-3">
4747
<div class="card-body">
48-
<h5 class="card-title">Entity ORM</h5>
49-
<p class="card-text mb-0">Manupulating the database using the object relational mapper</p>
50-
<a class="card-link stretched-link" routerLink="/docs/entity"></a>
48+
<h5 class="card-title">Security</h5>
49+
<p class="card-text mb-0">Protecting and controlling the access to the resources</p>
50+
<a class="card-link stretched-link" routerLink="/docs/security"></a>
5151
</div>
5252
</div>
5353
</div>
5454
<div class="col-sm-6 col-md-4 mb-3">
5555
<div class="card shadow-sm h-100 p-3">
5656
<div class="card-body">
57-
<h5 class="card-title">Security</h5>
58-
<p class="card-text mb-0">Protecting and controlling the access to the resources</p>
59-
<a class="card-link stretched-link" routerLink="/docs/security"></a>
57+
<h5 class="card-title">Entity ORM</h5>
58+
<p class="card-text mb-0">Manupulating the database using the object relational mapper</p>
59+
<a class="card-link stretched-link" routerLink="/docs/entity"></a>
6060
</div>
6161
</div>
6262
</div>

src/app/security/authentication/authentication.component.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ <h3>Cookie-based Authentication</h3>
104104
$users->addRange($data);
105105

106106
$user = $users->where(fn ($user) => $user->Username == $form->getValue('username'))->first();
107-
if (!$user || $user->Password != $form->getValue('password')) &lcub;
107+
if (!$user || !password_verify($form->getValue('password'), $user->Password)) &lcub;
108108
return $context->Response->setStatusCode(401);
109109
}
110110

@@ -177,7 +177,6 @@ <h3>Token-based Authentication</h3>
177177
return $context->Response->redirect('/account');
178178
}));
179179
});</code></pre>
180-
181180
<blockquote class="alert alert-warning">
182181
<b>Important:</b> The client should send back the JWT token in the Authorization header using the Bearer schema in the following format: <code>Authorization: Bearer &lt;token></code>
183182
</blockquote>

src/app/security/authorization/authorization.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ <h3>Simple Authorization</h3>
9595

9696
$user = new User();
9797
$user->Username = $form->Username;
98-
$user->Password = $form->Password;
98+
$user->Password = password_hash($form->Password, PASSWORD_DEFAULT);
9999
$user->Role = "User";
100100

101101
$data[] = $user;
@@ -323,7 +323,7 @@ <h3>Policy-based Authorization</h3>
323323
</a>
324324
</li>
325325
<li class="nav-page-item">
326-
<a class="nav-page-link" routerLink="/docs/security/identity">
326+
<a class="nav-page-link" routerLink="/docs/security/antiforgery">
327327
Next <i class="chevron right"></i>
328328
</a>
329329
</li>

0 commit comments

Comments
 (0)